[Twisted-Python] How to get an unused port

Gabriel Rossetti mailing_lists at evotex.ch
Wed Feb 27 05:57:35 EST 2008

Andrew Bennetts wrote:
> Gabriel Rossetti wrote:
>> Hello,
>> I need to be able to get an unused port for a server, it will then 
>> communicate it to a third party.
>> I don't have any restrictions other than it shouldn't be a known used port 
>> (one used by other apps (above 1023)), but for that I'll probably have to 
>> create a list and verify manually. Does anyone know how to do this (without 
>> iterating all ports and trying), it must be possible since a client gets 
>> the next unused port from the OS, I'd like to do this with Twisted if 
>> possible.
> Pass 0 as the port number.
> -Andrew.
Hello Andrew, thanks for the reply, I finally got it, see my last 
message on this thread.


More information about the Twisted-Python mailing list