check for unused ports and then grab one

Brad Tilley bradtilley at usa.net
Mon Sep 13 20:20:35 EDT 2004


Erik Heneryd wrote:

> Brad Tilley wrote:
> 
>> Cameron Laird wrote:
>>
>>> Incorrect, if I understand you both; *UNIX Network Programming*
>>> has said for years that
>>>   The process can let the system automatically assign   a port.  For 
>>> both the Internet domain and the XNS
>>>   domain, specifying a port number of 0 before calling
>>>   bind() requests the system to do this.
>>> While I've never tracked down an RFC that specifies this, it surely
>>> exists.
> 
> 
> Ah.  Nothing you use very often.  Closest I've come is opening a 
> (random) port in some interval.
> 
>> This works... even on winXP... thank you!
> 
> 
> Not very surprising considering that it's network code is based on BSD.
> 
> 
> Erik

Yeah, if it wasn't for the BSD license, Microsoft and Apple would have 
been forced to write more code than they have... there really is a 
merciful God ;)




More information about the Python-list mailing list