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,409 of 14,669   
   Barry Margolin to David Schwartz   
   Re: Can accept() block when the listener   
   19 Feb 10 21:06:17   
   
   bfaacba5   
   From: barmar@alum.mit.edu   
      
   In article   
   <7c8d3c7c-b826-4296-8e9b-c93f335fc8ef@t17g2000prg.googlegroups.com>,   
    David Schwartz  wrote:   
      
   > On Feb 18, 11:57 pm, Jorgen Grahn  wrote:   
   >   
   > > A short TCP question: if I have a listening (server) socket, and   
   > > select says it is readable, can I call accept() on it and expect it   
   > > not to block, even if the client/peer host/network dies at that very   
   > > moment?   
   >   
   > Nope. Just because it *was* readable doesn't mean it *is* readable.   
   >   
   > > The three-way handshake is supposed to be finished by the time select   
   > > says the listener is readable, isn't it?  Then accept() shouldn't have   
   > > to block.  I was somehow thinking accept triggered the last 2/3 of the   
   > > handshake, and thus might have to wait for RTT and retransmissions.   
   >   
   > No, but what can happen is that the other end can complete the three-   
   > way handshake and then RST the connection. The implementation does not   
   > have to return a dead connection to you (and what would be the point   
   > of it doing so?).   
      
   Accept could return an FD that reports ECONNRESET for any operation you   
   perform.   
      
   --   
   Barry Margolin, barmar@alum.mit.edu   
   Arlington, MA   
   *** PLEASE don't copy me on replies, I'll read them in the group ***   
      
   --- 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