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,789 of 14,669   
   Jorgen Grahn to Richard Kettlewell   
   Re: write(2) returning zero on a TCP soc   
   29 Jul 11 11:27:48   
   
   From: grahn+nntp@snipabacken.se   
      
   On Fri, 2011-07-29, Richard Kettlewell wrote:   
   > David Schwartz  writes:   
   >> Richard Kettlewell  wrote:   
   >   
   >>> That situation yields a return of -1 with errno=EPIPE (and raises   
   >>> SIGPIPE, though that might be ignored); or EBADF if you've closed at   
   >>> this end.   
   >>   
   >> Okay, here's a good non-answer for you: If 'write' returns zero, it   
   >> means no bytes were sent even though no error occurred.   
   >   
   > That would be an answer to "what would it mean".  The question was "how   
   > could it happen".   
   >   
   > In fact the "this supposedly happened" makes me suspect that the OP's   
   > interlocutor is just mistaken, and it didn't happen.  But evidence to   
   > the contrary would certainly be interesting.   
      
   Well, the "supposedly" here mostly means I haven't investigated it   
   myself. But yes, it's possible that the cause is mistakenly passing a   
   zero size to write(), or send(), or whatever that code uses.   
      
   Also, the guy who asked me had googled around and the message he got   
   from the few hits (in non-authorative sources) was something like "new   
   code must cope with a 0 return".   
      
   I was hoping that e.g. someone would pop out and say "yes, Linux does   
   it like that nowadays in  situations", like e.g. Mr Schwartz   
   did in the past when I asked about select() and blocking UDP sockets.   
   As far as I can see, that hasn't happened yet.   
      
   /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