[Twisted-Python] Limiting number of concurrent client connections

Justin Johnson justinjohnson at gmail.com
Tue Jun 28 08:50:49 MDT 2005


>From my experience, the problem has to do with more than just number of 
connections. I've reached the limit from spawning too many processes.

On 6/28/05, Jp Calderone <exarkun at divmod.com> wrote: 
> 
> On Tue, 28 Jun 2005 10:47:04 +0100, Toby Dickenson <
> tdickenson at devmail.geminidataloggers.co.uk> wrote:
> >Im finding that Win32Reactor raises an exception on every iteration of 
> the
> >main loop if I exceed the limit of 64 WaitForMultipleObjects.
> >
> >I would prefer to avoid this fairly obvious denial-of-service problem by
> >limiting the number of concurrent client connections. Is there a standard
> >solution for this?
> >
> 
> Count the number of connections you have accepted. When you get up to 62 
> or 63 or so, stop accepting new ones. If ServerFactory.buildProtocol() 
> returns None, Twisted immediately closes the accepted connection. If you do 
> this (perhaps in conjunction with calling stopListening() on the port 
> returned by listenXYZ()), you'll never overrun the 64 object limit.
> 
> Jp
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20050628/79506c90/attachment.html>


More information about the Twisted-Python mailing list