[Twisted-Python] running several services from a single app

Aljoša Mohorović aljosa.mohorovic at gmail.com
Mon Mar 28 11:29:38 EDT 2011


is it possible to run several services from a single app?
i currently have a few services/apps and would like to put them all
into a single app so i can use cx_freeze to create a single exe file
for windows to allow easy testing.

Aljosa

maybe something like this:
--------------------------------------------------------
factory1 = protocol.ServerFactory()
factory1.protocol = Protocol1
application1 = service.Application("Server1")
internet.TCPServer(8000, factory1).setServiceParent(application1)

factory2 = protocol.ServerFactory()
factory2.protocol = Protocol2
application2 = service.Application("Server2")
internet.TCPServer(9000, factory2).setServiceParent(application2)

reactor.listenTCP(8000, factory1)
reactor.listenTCP(9000, factory2)

reactor.run()
--------------------------------------------------------



More information about the Twisted-Python mailing list