[Twisted-Python] How to create a new service and listen on a new port?

Eric Hsu nkeric at gmail.com
Mon May 23 02:47:07 MDT 2005


Hi mark, big thanks for your quick reply :)
I guess I haven't make myself clear enough (sorry for my poor English... )
I'm not looking for a way to shutdown/stop my server :p

My question is, should I implement my requirments in the following way? (Use 
the "raw" reactor to create a new service and listen on a new port?)

[code]
class FooServer(DatagramProtocol):
def datagramReceived(self, data, addr):
# do something to verify the request and send the client with
a confirm msg
reactor.listenUDP(port2, AnotherService())
reactor.run()

class AnotherService(DatagramProtocol):
 # ...
[/code]

 I've already write my server as a "plugin" to the twisted framework (as the 
tutorial tought me), now I want to create a new service within my server, is 
there a more elegant/"formal" way?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20050523/56220cd2/attachment.html>


More information about the Twisted-Python mailing list