check for unused ports and then grab one
bradtilley at usa.net
Tue Sep 14 02:20:35 CEST 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
> 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.
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