<br><br><div class="gmail_quote">On Mon, Mar 28, 2011 at 8:29 AM, Aljoša Mohorović <span dir="ltr"><<a href="mailto:aljosa.mohorovic@gmail.com">aljosa.mohorovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
is it possible to run several services from a single app?<br>
i currently have a few services/apps and would like to put them all<br>
into a single app so i can use cx_freeze to create a single exe file<br>
for windows to allow easy testing.<br>
<br>
Aljosa<br>
<br>
maybe something like this:<br>
--------------------------------------------------------<br>
factory1 = protocol.ServerFactory()<br>
factory1.protocol = Protocol1<br>
application1 = service.Application("Server1")<br>
internet.TCPServer(8000, factory1).setServiceParent(application1)<br>
<br>
factory2 = protocol.ServerFactory()<br>
factory2.protocol = Protocol2<br>
application2 = service.Application("Server2")<br>
internet.TCPServer(9000, factory2).setServiceParent(application2)<br>
<br>
reactor.listenTCP(8000, factory1)<br>
reactor.listenTCP(9000, factory2)<br>
<br>
reactor.run() </blockquote><br><br>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.<br>
</div>