[Twisted-Python] How to get port when using application

Gabriel Rossetti mailing_lists at evotex.ch
Mon May 5 11:20:26 EDT 2008

Hello, I am going to use application and I have a question,
I have a server that needs to get a free port, before I would do this :


    port = reactor.listenTCP(0, f).getHost().port


and now with application all I could find to do the equivilent was :


    t = internet.TCPServer(0, tcpFactory)
    port = p._getPort()._realPortNumber
the problem is that this isn't very clean as I'm accessing protected 

Is there a better way of doing this?

Thank you,

More information about the Twisted-Python mailing list