From: barmar@alum.mit.edu   
      
   In article ,   
    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? Stevens and the Linux man page says so, but only implicitly,   
   > by saying it will block if the fd isn't readable.   
      
   You can't read or write on a listening socket, the only thing you can do   
   with it is accept().   
      
   >   
   > *Thinking*   
   >   
   > 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.   
      
   Your first understanding is correct. The socket is marked readable and   
   writable after the handshake is complete.   
      
   --   
   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)   
|