check for unused ports and then grab one

Erik Heneryd erik at heneryd.com
Mon Sep 13 20:05:28 EDT 2004


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



More information about the Python-list mailing list