Re: How to reuse TCP listening socket immediately after it wasconnected at least once?

Discussion in 'Python' started by Igor Katson, May 24, 2009.

  1. Igor Katson

    Igor Katson Guest

    Igor Katson wrote:
    > I have written a socket server and some arbitrary clients. When I
    > shutdown the server, and do socket.close(), I cannot immediately start
    > it again cause it has some open sockets in TIME_WAIT state. It throws
    > address already in use exception at me. I have searched for that in
    > google but haven't found a way to solve that.
    >
    > Tried
    > setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    > but that does not help.
    >
    > Is there a nice way to overcome this?

    Solved myself. SO_REUSEADDE should be used on the second listening
    socket creation (while time_wait already hangs)
    Igor Katson, May 24, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    5
    Views:
    513
    Steve C. Orr [MVP, MCSD]
    May 17, 2005
  2. Tiger
    Replies:
    5
    Views:
    950
    Dave Thompson
    May 1, 2006
  3. AAaron123
    Replies:
    0
    Views:
    558
    AAaron123
    Oct 3, 2008
  4. Igor Katson
    Replies:
    11
    Views:
    19,363
    Lawrence D'Oliveiro
    May 31, 2009
  5. Replies:
    4
    Views:
    297
Loading...

Share This Page