[Twisted-Python] Possible to delay connectTCP?

Christopher Armstrong radix at twistedmatrix.com
Fri Aug 31 19:56:02 EDT 2007


On 8/31/07, Beau Hargis <beau at subobscur.us> wrote:
>
> I have an application which connects to a machine which has 50-60 ports
> open on it to receive data (each for a different region). It acts like a
> switch. Problem is that when I make all those connection requests at the
> same time the server falls over trying to handle all the connections
> requests from my application. I cannot control or change the behaviour of
> the server I am connecting to, however, I am also unable to find a way to
> easily to add a delay between connection requests in twisted (without
> blocking the reactor), so that only 2 or 3 start up at a time.
>
> Is there an elegant and clean way to do such a thing? Twisted has worked
> beautifully for everything else, but I can't replace this one server for a
> while until I can duplicate the rest of its functionality, so I am dependant
> on it providing the data.


The way to delay (that is, schedule) function calls until a later point in
time is reactor.callLater(seconds, callable, *args, **kwargs).

-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070831/2e53799d/attachment.htm 


More information about the Twisted-Python mailing list