|There's more than one way to do things|
TCP server: How to reject connections when busy?by squirrel (Novice)
|on Nov 29, 2011 at 17:21 UTC||Need Help??|
squirrel has asked for the
wisdom of the Perl Monks concerning the following question:
How can I make a TCP server process reject new connections when it is busy?
Starting with a basic server such as the first server here: http://perldoc.perl.org/perlipc.html#Sockets%3a-Client%2fServer-Communication
The server accepts an incoming connection and processes it. New connections are queued and the next accept picks up the next connection - all good. But I want to reject new incoming connections while it is busy (so that the client process can try a different box).
I thought the backlog parameter to listen would do this:
or maybelisten(Socket, 1)
but it does not seem to make any difference to the queueing behavior whatever value I set in listen.
OS is Ubuntu 11.10 and RedHat 5.6