![](https://secure.gravatar.com/avatar/dc1aa795ec44b3524526e654111caa97.jpg?s=120&d=mm&r=g)
Why not simply start the additional services from the startFactory-method of your mainservice' protocol factory? i,e,: class MainServiceFac(ServerFactory): def startFactory(self): <possibly call parent's startFactory> reactor.listenTCP(.... subservice 1) reactor.listenTCP(.... subservice 2).... On Fri, 2006-06-16 at 10:39 -0300, David Pratt wrote:
Chaz. wrote:
I don't think there is a way to insure you will get the ports you want. Why bother testing if the port is available before hand? In between the port being tested and the application using it someone can sneak in and take it.
Hi Chaz. Thank you for your reply. The reason for the test is that I don't want the other services to start at all if a connection cannot be found to run the main service. I was thinking of writing a simple tester using socket module to determine which addresses are alive first. When it finds one it stops so in my logic I give this address to my ListenTCP/SSL and attempt to start the main service.
I don't expect the address list to be large. This way no time is lost with the client running through a long backoff cycle on an address that may not be alive only to have to stop it and try a another until one is possibly found.
I am not aware of something in twisted that evaluates addresses like this as part of a startup solution. In any case, if I see that an address in the list is available, then I would start my main service using it. When a connection is made to the main address, then I want to start the remaining services since they are useless without the main service.
Regards, David
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python