
On Mon, Mar 28, 2011 at 8:29 AM, Aljoša Mohorović < aljosa.mohorovic@gmail.com> wrote:
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()
Get rid of 'application1' and 'application2' and just create a single one named 'application' , delete the last three lines, and this code will work just fine as a .tac file. You only need one call to 'Application' per process, but you can have many services and many clients and servers in a process.