[Twisted-Python] UDP and factories

I am attempting to use DatagramProtocol with a factory are u supposed to use DatagramProtocol with a factory ?? am i out to lunch ? ie from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor from twisted.internet.protocol import Factory class Echo(DatagramProtocol): def datagramReceived(self, data, (host, port)): print "received %r from %s:%d" % (data, host, port) self.transport.write(data, (host, 7000)) echo_factory = Factory() echo_factory.protocol = Echo reactor.listenUDP(6000,echo_factory) reactor.run() I am using twisted v 1.05 and windows XP everytime i attempt to run the above code i get Traceback (most recent call last): File "pyRtp.py", line 97, in ? reactor.listenUDP(6000,echo_factory) File "E:\Python22\Lib\site-packages\twisted\internet\default.py", line 181, in listenUDP p = udp.Port(port, protocol, interface, maxPacketSize, self) File "E:\Python22\Lib\site-packages\twisted\internet\udp.py", line 65, in __in it__ assert isinstance(proto, protocol.DatagramProtocol) AssertionError what am i doing wrong ? If i am not supposed to use a factory with UDP what is a better solution ? Thanx :)

On Fri, Aug 08, 2003 at 05:18:05PM -0600, John Janecek wrote:
Yes, you are -- but don't worry, it was leftover ham sandwiches ;] No, you do not need to use a factory for a DatagramProtocol. Thus:
Look at <http://twistedmatrix.com/documents/howto/udp> for more information. -- Alex Levy WWW: http://mesozoic.geecs.org "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_

On Fri, Aug 08, 2003 at 05:18:05PM -0600, John Janecek wrote:
Yes, you are -- but don't worry, it was leftover ham sandwiches ;] No, you do not need to use a factory for a DatagramProtocol. Thus:
Look at <http://twistedmatrix.com/documents/howto/udp> for more information. -- Alex Levy WWW: http://mesozoic.geecs.org "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_
participants (2)
-
Alex Levy
-
John Janecek