[Twisted-Python] unlistenTCP not working?
warner at lothar.com
Fri Jul 25 13:58:28 EDT 2003
> Ok, I didn't realise listenTCP returned Port objects.
Also note the returned Port object can tell you which proto/host/port it is
listening on. This means you can tell it to listen on "0" (which means "pick
the next available port") and then find out later which port number it
decided to use. This could be useful for things like the FTP data port where
each file transfer opens up a new port and the port number is sent over an
existing connection to the other end.
p = reactor.listenTCP(0, factory)
print "now listening on port", p.getHost()
More information about the Twisted-Python