[Twisted-Python] Re: How to get an unused port

Martin Geisler mg at daimi.au.dk
Wed Feb 27 06:22:29 EST 2008

Gabriel Rossetti <mailing_lists at evotex.ch> writes:

>> You will never want to connect to port 0 -- there is no such port
>> as far as I know. Instead you can listen on it. The OS will then
>> allocate a free port for you to listen on.
>> So I think you have turned things upside down here :-)
> Yes, I realized that just after sending the email :-)

Its always like that... :-) I'm glad you got it working!

> like you said :
>>>> reactor.listenTCP(0, Factory()).getHost().port
> 59768
> work :-)

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.

More information about the Twisted-Python mailing list