Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Twisted Matrix and multicast broadcast

Reply
Thread Tools

Twisted Matrix and multicast broadcast

 
 
Stodge
Guest
Posts: n/a
 
      10-09-2008
I'm trying to get a simple multicast application working using
Twisted; so far I have:

from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.application.internet import MulticastServer

class MulticastServerUDP(DatagramProtocol):
def startProtocol(self):
print 'Started Listening'
# Join a specific multicast group, which is the IP we will
respond to
self.transport.joinGroup('224.0.0.1')

def datagramReceived(self, datagram, address):
# The uniqueID check is to ensure we only service requests
from
# ourselves
if datagram == 'UniqueID':
print "Server Received: " + repr(datagram)
self.transport.write("data", address)

# Listen for multicast on 224.0.0.1:8005
reactor.listenMulticast(8005, MulticastServerUDP())
reactor.run()


and:



from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.application.internet import MulticastServer

class MulticastClientUDP(DatagramProtocol):
def startProtocol(self):
print 'Started Listening'
# Join a specific multicast group, which is the IP we will
respond to
self.transport.joinGroup('224.0.0.1')

self.transport.write('UniqueID',('224.0.0.1', 8005))

def datagramReceived(self, datagram, address):
print "Received:" + repr(datagram)

# Send multicast on 224.0.0.1:8005, on our dynamically allocated port
reactor.listenMulticast(0, MulticastClientUDP())
reactor.run()

************************************************** **********************************

No surprises there! But how do I get the server to send to all clients
using multicast? transport.write requires an address. Any suggestions
appreciated.

Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Twisted Matrix and multicast broadcast Jean-Paul Calderone Python 1 10-09-2008 01:54 PM
Flow control and multicast or broadcast traffic Rahan Cisco 0 08-07-2006 04:14 PM
Multicast vs. Broadcast frames Yaron Cisco 5 11-21-2005 11:27 PM
ISIS multicast addr on broadcast nets? wysiwyg21 Cisco 4 06-28-2005 10:35 PM
Broadcast and Multicast problem sPiDEr Cisco 3 07-11-2003 07:41 AM



Advertisments