Loading ...
Sorry, an error occurred while loading the content.

bind address doubt

Expand Messages
  • Rajendra Stalekar
    Hi folks, I have a server-client application. I do the following steps 1. Start the server. 2. Start the client. 3.Abort the server(which means Ctrl-C), but
    Message 1 of 3 , Apr 30, 2003
    • 0 Attachment
      Hi folks,
      I have a server-client application.
      I do the following steps

      1. Start the server.
      2. Start the client.
      3.Abort the server(which means Ctrl-C), but client is
      still alive
      4. Next i restart the server , it gives bind address
      already in use.

      Now i do a netstat, and i find that on the server
      side, the socket is in FIN_WAIT2 state.

      Client side is in CLOSE_WAIT state.

      Why does'nt the server go in TIME_WAIT state waiting
      for the FIN from the client to come to server.

      Instead the server goes to CLOSE state, why is that?

      Regards,
      Rajendra S.


      __________________________________________________
      Yahoo! Plus
      For a better Internet experience
      http://www.yahoo.co.uk/btoffer
    • vikas g p
      Hi, AFAIK, when the server calls close() on a TCP socket, the TCP layer waits for some time before actually closing the socket and freeing the port for re-use.
      Message 2 of 3 , May 2 12:06 AM
      • 0 Attachment
        Hi,

        AFAIK, when the server calls close() on a TCP socket,
        the TCP layer waits for some time before actually
        closing the socket and freeing the port for re-use. I
        presume this is done so that any pending ACK's are
        recieved. I vaguely know that there might be a way to
        over-ride this. The Unix Socket FAQ
        (http://www.ibrado.com/sock-faq/) has some information
        on this(look under the "Please explain TIME_WAIT"
        question).

        A kludge sort of way to avoid this problem would be to
        have the server keep trying to get the port and output
        a message like "Now accepting" when it succeeds. The
        client should be started only after you see this
        message.



        __________________________________
        Do you Yahoo!?
        The New Yahoo! Search - Faster. Easier. Bingo.
        http://search.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.