RE: sendfile to nonblocking socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux