Messages in this thread | | | From | "David Schwartz" <> | Subject | RE: sendfile to nonblocking socket | Date | Mon, 23 Apr 2007 15:52:58 -0700 |
| |
> As I see, nonblocking mode is enabled - sendfile sends less than asked. > But 2G via single 30 seconds sendfile call - this is blocking call. How > can I avoid that? I prefer sendfile as fastest way to send file > content to network socket. The problem with sendfile block on > nonblocking socket has place only when I'm using network connection, > that is faster than my hard disk, for example gigabit NIC or localhost. > When I use 100Mbit NIC, which is slower, than my hard disk, I got small > and fast sendfile calls without blocking. > > My kernel is Linux 2.6.20.3-grsec x86_64. I verified that also on > 2.6.18 - same results. Please advise.
You have a misunderstanding about the semantics of 'sendfile'. The 'sendfile' function is just a more efficient version of a read followed by a write. If you did a read followed by a write, it would block as well (in the read).
DS
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |