[Twisted-Python] UDP question
Alec Matusis
matusis at matusis.com
Sat Jul 8 16:54:43 MDT 2006
>You can have as many processes listening on a single MULTICAST UDP port as
you like.
Well, I am trying to run this example multicast UDP server:
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
self.transport.joinGroup('225.0.0.1')
def datagramReceived(self, datagram, address):
self.transport.write("data",address)
reactor.listenMulticast(8005, MulticastServerUDP())
reactor.run()
when I try running more that one instance of this on the same machine I get
twisted.internet.error.CannotListenError: Couldn't listen on any:8005: (98,
'Address already in use').
So my quiestion is how can I have multiple processes listening for multicast
on the same machine?
________________________________
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com] On Behalf Of jarrod
roberson
Sent: Saturday, July 08, 2006 2:57 PM
To: Twisted general discussion
Subject: Re: [Twisted-Python] UDP question
On 7/8/06, Alec Matusis <matusis at matusis.com> wrote:
I have a question about using UDP in twisted. I hope people will
forgive my
naiveté, since my background is in physics, not in CS, so I am
self-taught
and may be missing something obvious.
I would like a server to send UDP broadcasts to multiple clients,
where all
clients receive the same broadcast.
>From what I understood from
http://twistedmatrix.com/projects/core/documentation/howto/udp.html
<http://twistedmatrix.com/projects/core/documentation/howto/udp.html>
Multicast UDP section, one can have a client broadcast the same UDP
packet
to multiple servers, each server listening on the same port for this
multicast.
This is unacceptable for me, since all of this must happen on the
same
machine, so I cannot bind multiple servers to the same port on one
box. So I
am trying to implement a reverse scenario, where the server will do
the
multicast to clients, but all clients and the server may (or may
not) be
running on the same box.
actually you can, you need to read up on how MULTICAST works.
It isn't the same thing as uni-cast UDP.
You can have as many processes listening on a single MULTICAST UDP port as
you like.
ZeroConf / Apple Bonjour ( formerly Rendezous ) usings multicast udp to do
just that.
How can I do this in twisted? Could you give me and example? Thanks.
--
If you don't know what you want, you probably need a nap.
More information about the Twisted-Python
mailing list