[Twisted-Python] How to get an unused port
matt at madebykite.com
Wed Feb 27 04:24:08 EST 2008
If memory serves me correctly, when calling reactor.ConnectTCP,
specify zero for your port, you'll automatically get an unused port
from the dynamic range.
Hope that helps,
email: matthew.glubb at madebykite.com
phone: 44 (0) 7715 754017
GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
On 27 Feb 2008, at 09:06, Gabriel Rossetti wrote:
> 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.
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python