[Twisted-Python] multicast

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Dec 16 10:31:01 EST 2010

On 10:09 am, ypercube at gmail.com wrote:
>On Thu, Dec 16, 2010 at 2:06 AM, Itamar Turner-Trauring 
><itamar at itamarst.org
>>On Wed, 2010-12-15 at 18:07 +0200, Pandelis Theodosiou wrote:
>> > I'm trying to make a Multicast client.
>> >
>> > I've tried the simple script found in:
>> > http://twistedmatrix.com/documents/10.1.0/core/howto/udp.html#auto3
>> >
>> > While it shows no errors, it doesn't receive any data. How can I 
>> > what the problem is?
>>You didn't do the necessary joinGroup() call, which is in the original
>I made many trials, and one was like this:
>from twisted.internet.protocol import DatagramProtocol
>from twisted.internet import reactor
>from twisted.application.internet import MulticastServer
>class MulticastClientUDP(DatagramProtocol):
>    def startProtocol(self):
>        self.transport.joinGroup('')
>    def datagramReceived(self, datagram, address):
>            print "Received:" + repr(datagram)
># Trying to receive from, on our dynamically allocated 
>reactor.listenUDP(60044, MulticastClientUDP())
>But datagramReceived is never called. Am I doing something wrong?
>Is there any other method that should be called so I start listening on 
>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 
>multicast port and I don't need that.

Then it may indeed be an issue with a routing device somewhere near your 
tests.  Dropping all multicast traffic is a common behavior to encounter 
in firewalls and home routers.

Maybe if you play with iptables or the equivalent on your system you'll 
be able to fix this.


More information about the Twisted-Python mailing list