home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 13,770 of 14,669   
   Richard Kettlewell to Jorgen Grahn   
   Re: write(2) returning zero on a TCP soc   
   27 Jul 11 10:22:07   
   
   From: rjk@greenend.org.uk   
      
   Jorgen Grahn  writes:   
   > I got this question at work, and was a bit annoyed that I couldn't   
   > easily find a straight answer in the man pages or in Stevens.   
   >   
   > Under what conditions could write(sock, buf, n), with n>0, return zero   
   > for a TCP socket?  According to POSIX?  In Linux?   
   >   
   > The return values I'm comfortable with are:   
   > n      - all got written   
   > 1..n-1 - partial write   
   > -1     - fatal error, EINTR or EWOULDBLOCK   
   >   
   > That doesn't seem to leave room for a distinct meaning of 0.   
   >   
   > This supposedly happened to the guy who asked me, on Linux. I'm not   
   > sure if the socket was set blocking or nonblocking.   
      
   The nonstandard O_NDELAY can (could?) cause this on some platforms,   
   though I don't believe Linux is one of them.   
      
   --   
   http://www.greenend.org.uk/rjk/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca