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,771 of 14,669   
   Jorgen Grahn to All   
   write(2) returning zero on a TCP socket   
   27 Jul 11 08:33:01   
   
   From: grahn+nntp@snipabacken.se   
      
   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.   
      
   /Jorgen   
      
   --   
     // Jorgen Grahn    O  o   .   
      
   --- 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