<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2016, at 6:41 AM, Shantanoo Desai <<a href="mailto:itsmeshantanu@hotmail.com" class="">itsmeshantanu@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I am trying to use the<span class="Apple-converted-space"> </span><b class="">.joinGroup()</b><span class="Apple-converted-space"> </span>by passing the IPv6 link-local multicast add.<span class="Apple-converted-space"> </span><b class="">ff02::1<span class="Apple-converted-space"> </span></b>but get DNS lookup failure error.<br class=""><br class="">I am trying to use the UDP multicast example on the<span class="Apple-converted-space"> </span><a href="http://twistedmatrix.com/" class="">twistedmatrix.com</a><span class="Apple-converted-space"> </span>website and simply replacing the IPv4 multicast address with the IPv6 one.<br class=""><br class="">I have also posted a query on StackOverflow:<span class="Apple-converted-space"> </span><a href="http://stackoverflow.com/questions/36034258/ipv6-link-local-multicast-on-twisted" target="_blank" class="">http://stackoverflow.com/questions/36034258/ipv6-link-local-multicast-on-twisted</a><br class=""><br class="">I am newbie on Twisted and some suggestions would be appreciated.<span class="Apple-converted-space"> </span><br class=""></div></div></blockquote></div><br class=""><div class="">I haven't had time to fully investigate, but unfortunately, this is probably a hard-coded limitation of Twisted, currently.  The right thing for you to do would be to contribute a patch to Twisted that fixes this; please file a ticket for that if there isn't one already.</div><div class=""><br class="">But, in the interests both of telling you how you might write that patch, and also how to work around it right now, let me explain: 'listenMulticast' constructs a MulticastPort which has an addressFamily of AF_INET (i.e.: IPv4).  In order to join an IPv6 group, you would need one that supports IPv6.</div><div class=""><br class=""></div><div class="">The <i class="">right</i> way to do this within Twisted is to set the address family the way that twisted.internet.tcp._BaseTCPClient does; check if the input 'interface' is a literal ipv4 or ipv6 address and set the self.addressFamily accordingly.</div><div class=""><br class=""></div><div class="">However, assuming you don't care about Windows, as a quick workaround (this is NOT a good long-term solution; at some point in the distant future, `twisted.internet.udp´ will hopefully disappear as an importable module, since you should always be doing this sort of thing via the reactor), you could do something like this:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">from socket import AF_INET6</div><div class="">from twisted.internet.udp import MulticastPort</div><div class=""><br class=""></div><div class="">class MyMulticastPort(MulticastPort, object):</div><div class="">    addressFamily = AF_INET6</div><div class=""><br class=""></div><div class="">def listenMulticast(reactor, port, protocol, interface='', maxPacketSize=8192,</div><div class="">                    listenMultiple=False):</div><div class="">    p = MyMulticastPort(port, protocol, interface, maxPacketSize, reactor,</div><div class="">                        listenMultiple)</div><div class="">    p.startListening()</div><div class="">    return p</div></div><div class=""><br class=""></div></blockquote>Note that this is totally untested, which is why I'm answering here and not Stack Overflow :-).  Let me know if it works!<br class=""><div class=""><br class=""></div><div class="">-glyph</div><div class=""><br class=""></div></body></html>