[Twisted-Python] Setting source address of outgoing datagrams

Richard Wall m-lists at the-moon.net
Wed Oct 16 06:14:46 MDT 2013


On 16 October 2013 12:47, Itamar Turner-Trauring <itamar at itamarst.org> wrote:
> On 10/16/2013 03:36 AM, Maciej Wasilak wrote:
>> All in all the problem with using wrong source address can be easilly
>> solved with a bit of user attention, however it's hard to find the solution
>> that "just works".
>>
> There's an OS API (recvmsg?) that lets you get at this information; I
> believe Twisted has the start of a wrapper for it. Given a full wrapper we
> could create a new UDP API that did support this easily.

Here's a good description of how PowerDNS solved this problem using recvmsg:
 * http://bert-hubert.blogspot.nl/2012/10/on-binding-datagram-udp-sockets-to-any.html

I don't think it's currently possible to listenUDP on a specific IPv6 address:
 * https://twistedmatrix.com/trac/ticket/5086

But the branch for that ticket is almost ready to be merged... it just
needs a few custom exception classes I think.

-RichardW.



More information about the Twisted-Python mailing list