[Twisted-Python] Bring multi service up gradually

Chaz. eprparadocs at gmail.com
Fri Jun 16 09:46:15 EDT 2006

I would know how to do it in C, but I am no twisted expert. The idea
would be to open the socket and hand it off to the service to use. I am
sure there is a way to do it in Twisted (opening a port and using it in
a service).

What you don't want to do is just "test" the port (opening it and
closing it). Once you have it opened, you need to keep it open.


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

More information about the Twisted-Python mailing list