Client-side TCP socket receiving "Address already in use" upon connect

Steve Holden steve at holdenweb.com
Sun Sep 3 13:53:09 CEST 2006


keegan.csmith at gmail.com wrote:
>>I've read about SO_REUSEADDR. As far as I understand, this is what
>>SO_REUSEADDR is for:
> 
> ....
> 
>>I've tried setting this option, but could not see any notable changes...
> 
> 
> I was having a similiar problem as you, where as soon as my program
> exited, it would get started up again, but could not bind to the same
> address.
> So i added the follow straight after I create my server object:
> server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> 
> And it worked. Note that my program was running on Linux, so this might
> be a windows issue.
> 
... and note also that your program was apprently a server, while the OP 
was reporting an error on a client program that presumably asks for an 
ephemeral port rather than a specifically-numbered one.

Since there are roughly 64,000 ports, the real question seems to be why 
his client runs out after about 4,000.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list