[Twisted-Python] Getting local UDP address/port

Olivier Parisy olivier.parisy at free.fr
Sat Nov 14 08:56:50 MST 2009


exarkun at twistedmatrix.com a écrit :
> The protocol's transport will give you this information via the getHost 
> method:
>
> http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IUDPTransport.html
>   
I got confused by the method name and did not think it would provide me 
with the local port. This is exactly what I needed, thanks!

> However, unless you're using connected UDP, the platform may not bother 
> to give you a realistic local address (and perhaps sometimes even for 
> connected UDP it won't).  And then there's always NAT.
>   
Yes, I am aware of those issues. This is kind of the point of my test 
actually.

Thanks,
Olivier.






More information about the Twisted-Python mailing list