[Twisted-Python] Unable to get the UDP multicasting examples to work
Hi, This may well be a very trivial question but i have been trying to get the UDP multicasting example in the "how to" section of the twisted documentation to work and have had no success. I can do TCP message and normal UDP but cant multicast it. It does not report any errors but nothing every seems to be received by the echo server. Don't I need to explicitly join the multicast group at any point? The code i have been using is as follows: The multicast client: from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor class Client(DatagramProtocol): def datagramReceived(self, data, host): print 'Response Recieved:', data.strip() print 'From Host:', host reactor.listenUDP(0, Client()).write('broadcast\n', ('224.0.0.1', 9999)) reactor.run() The original Echo server: from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor class Echo(DatagramProtocol): def datagramReceived(self, data, (host, port)): print "received %r from %s:%d" % (data, host, port) self.transport.write(data, (host, port)) reactor.listenUDP(9999, Echo()) reactor.run() Thanks for any help, Alan.
On Thu, 20 Nov 2003 10:48:10 +0000 "Alan Rushforth" <Alan.Rushforth@student.shu.ac.uk> wrote:
multicasting example in the "how to" section of the twisted documentation to work and have had no success. I can do TCP message and normal UDP but cant multicast it.
Bleh. My bad (well, and Pahan's). You want to use listenMulticast, really, and you need to join() a group. See twisted.internet.interfaces - the multicast stuff, and twisted.test.test_udp. I will remove the offending docs. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting
participants (2)
-
Alan Rushforth
-
Itamar Shtull-Trauring