[Twisted-Python] the magical port 0
Glyph Lefkowitz
glyph at twistedmatrix.com
Fri May 11 22:10:55 MDT 2001
I looked at this, but I think the current approach is best.
Since servers are (optionally) persistent, the fact that server.port is 0
tells you that the next time the server is brought in from a persistent
store, it may be on a different port.
My suggestion for this application is to call through directly to
server.socket.getsockname()[1] directly.
On Friday 11 May 2001 16:26, you wrote:
> Hello,
>
> As you might know, binding to port 0, actually binds an unallocated port;
> but despite how useful this might be, twisted.net returns port 0 anyway.
>
> The fix is easy, and that is to set port = skt.getsockname()[1] right after
> it has been binded.
> I don't if this applies to win32, or any other platform, but I assume that
> it does.
>
> I have not done this in CVS, but I hope someone with more insight into
> twisted.net could do it :)
>
> phed
> www.informative.f2s.com (be gone evil .zip-hating provider)
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
--
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
http://twistedmatrix.com/users/glyph
More information about the Twisted-Python
mailing list