[Pythonmac-SIG] SO_REUSEADDR not work

Nick Bastin nbastin at opnet.com
Sun Feb 15 16:21:01 EST 2004


On Feb 15, 2004, at 4:07 PM, Jack Jansen wrote:

>
> On 13 Feb 2004, at 17:37, Samuel M. Smith wrote:
>
>> According to my understanding of the socket library a port can be 
>> made reusable or used by another socket
>> with the socket option SO_REUSEADDR however I can't seem to get it to 
>> work.
>
> I always forget what SO_REUSEADDR means exactly, but it is something 
> obscure, I think it only has to do with reusing an (address, port) 
> combination that is still in some sort of waiting state (after a 
> connnection having aborted, for instance).

SO_REUSEADDR allows you to bind to a port that is already bound by 
someone else.  This is mostly relevant if you want to bind to multiple 
(port, local_address) pairs with individual threads.  All calls after 
the first would fail if you didn't use SO_REUSEADDR because bind 
doesn't know/care about which address you're listening on.  Also, if 
you're doing something like Apache and spawing off clients from a 
listener and needing to restart the listener.

--
Nick




More information about the Pythonmac-SIG mailing list