[Twisted-Python] How to get an unused port
Andrew Bennetts
andrew-twisted at puzzling.org
Wed Feb 27 04:20:46 EST 2008
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.
More information about the Twisted-Python
mailing list