<br><br><div class="gmail_quote">On Thu, Dec 16, 2010 at 2:06 AM, Itamar Turner-Trauring <span dir="ltr"><<a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Wed, 2010-12-15 at 18:07 +0200, Pandelis Theodosiou wrote:<br>
> I'm trying to make a Multicast client.<br>
><br>
> I've tried the simple script found in:<br>
> <a href="http://twistedmatrix.com/documents/10.1.0/core/howto/udp.html#auto3" target="_blank">http://twistedmatrix.com/documents/10.1.0/core/howto/udp.html#auto3</a><br>
><br>
> While it shows no errors, it doesn't receive any data. How can I check<br>
> what the problem is?<br>
<br>
</div>You didn't do the necessary joinGroup() call, which is in the original<br>
example.<br>
<br></blockquote><div><br>I made many trials, and one was like this:<br><br><span><pre><font size="2"><span style="font-family: courier new,monospace;">from</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">twisted</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">internet</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">protocol</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">import</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">DatagramProtocol</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">twisted</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">internet</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">import</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">reactor</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">twisted</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">application</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">internet</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">import</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">MulticastServer</span><br style="font-family: courier new,monospace;">
<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">MulticastClientUDP</span><span style="font-family: courier new,monospace;">(</span><span style="font-family: courier new,monospace;">DatagramProtocol</span><span style="font-family: courier new,monospace;">):</span><br style="font-family: courier new,monospace;">
<br> def startProtocol(self):<br> self.transport.joinGroup(</font><font size="2"><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">'233.75.215.44'</span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">)</span></font><span></span><br>
<font size="2"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">def</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">datagramReceived</span><span style="font-family: courier new,monospace;">(</span><span style="font-family: courier new,monospace;">self</span><span style="font-family: courier new,monospace;">, </span><span style="font-family: courier new,monospace;">datagram</span><span style="font-family: courier new,monospace;">, </span><span style="font-family: courier new,monospace;">address</span><span style="font-family: courier new,monospace;">):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">print</span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">"Received:"</span><span style="font-family: courier new,monospace;"> + </span><span style="font-family: courier new,monospace;">repr</span><span style="font-family: courier new,monospace;">(</span><span style="font-family: courier new,monospace;">datagram</span><span style="font-family: courier new,monospace;">)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># Trying to receive from 233.75.215.44, on our dynamically allocated port</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">reactor</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">listenUDP</span><span style="font-family: courier new,monospace;">(</span><span style="font-family: courier new,monospace;">60044</span><span style="font-family: courier new,monospace;">, </span><span style="font-family: courier new,monospace;">MulticastClientUDP</span><span style="font-family: courier new,monospace;">())</span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">reactor</span><span style="font-family: courier new,monospace;">.</span><span style="font-family: courier new,monospace;">run</span><span style="font-family: courier new,monospace;">()</span></font></pre>
</span> But datagramReceived is never called. Am I doing something wrong? <br>Is there any other method that should be called so I start listening on that group?<br><br>I've also tried to use listenMulticast instead of listenUDP but then I realized this is if I need more than one application to listen/write to the multicast port and I don't need that.<br>
pandelis<br></div></div><br>