server bootstrapping upon connection (WARNING: LONG)

Alan Kennedy alanmk at hotmail.com
Wed Feb 11 20:50:02 CET 2004


[ralf at brainbot.com]
>>>> I just wanted to say, that even if the server is
>>>> listening on that port, that connection attempts may fail.

[Benjamin Han]
>>> How is it possible? Could you explain a bit more?

[Krzysztof Stachlewski]
>> Your server may be accepting connections slower than
>> the speed at which new connections are coming.
>> In such situation your operating system maintains a list
>> of those awaiting connections. You can control the length of
>> this list with the "backlog" parameter of the "listen" function.
>> If the list is full, new connections may simply be dropped
>> as if the server was not listening at all.

[Benjamin Han]
> Thanks for the tip - the default queue size is 5. I've since changed it
> into 100 (much more than what it actually needs), but the original
> problem remains.

Another quick point: even if you set the backlog to 100 connections,
that only gives you 3.3333r seconds of grace before the backlog of
connections fills up, given the "up to 30 connections/second" you
mentioned in another message.

The 101st client to attempt a connect() will fail, if the server
doesn't start accept()ing connections before the backlog fills up.

HTH,

-- 
alan kennedy
------------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/contact/alan



More information about the Python-list mailing list