<div dir="ltr"><div>Richard,<br><br></div><div>thank you very much - this post is exactly what I need. Python supports recvmsg, and sendmsg from version 3.3, but Twisted has its own implementation that is 2.7 compatible. I'll try that right away. I think it's best to include the recvmsg/sendmsg code into my DatagramProtocol subclass.<br>
<br></div><div>Best Regards<br></div><div>Maciek<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/16 Richard Wall <span dir="ltr"><<a href="mailto:m-lists@the-moon.net" target="_blank">m-lists@the-moon.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 16 October 2013 12:47, Itamar Turner-Trauring <<a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a>> wrote:<br>

> On 10/16/2013 03:36 AM, Maciej Wasilak wrote:<br>
>> All in all the problem with using wrong source address can be easilly<br>
>> solved with a bit of user attention, however it's hard to find the solution<br>
>> that "just works".<br>
>><br>
> There's an OS API (recvmsg?) that lets you get at this information; I<br>
> believe Twisted has the start of a wrapper for it. Given a full wrapper we<br>
> could create a new UDP API that did support this easily.<br>
<br>
</div>Here's a good description of how PowerDNS solved this problem using recvmsg:<br>
 * <a href="http://bert-hubert.blogspot.nl/2012/10/on-binding-datagram-udp-sockets-to-any.html" target="_blank">http://bert-hubert.blogspot.nl/2012/10/on-binding-datagram-udp-sockets-to-any.html</a><br>
<br>
I don't think it's currently possible to listenUDP on a specific IPv6 address:<br>
 * <a href="https://twistedmatrix.com/trac/ticket/5086" target="_blank">https://twistedmatrix.com/trac/ticket/5086</a><br>
<br>
But the branch for that ticket is almost ready to be merged... it just<br>
needs a few custom exception classes I think.<br>
<br>
-RichardW.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br></div>