Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: TCP server: How to reject connections when busy?

by JavaFan (Canon)
on Nov 29, 2011 at 17:42 UTC ( #940664=note: print w/replies, xml ) Need Help??

in reply to TCP server: How to reject connections when busy?

From man listen:
The backlog parameter defines the maximum length the queue of + pending connections may grow to. If a connection request arrives w +ith the queue full the client may receive an error with an indication +of ECON- NREFUSED or, if the underlying protocol supports retransmissi +on, the request may be ignored so that retries succeed.
So, it looks like connection request are just ignored (as TCP does support retransmission).

Replies are listed 'Best First'.
Re^2: TCP server: How to reject connections when busy?
by squirrel (Novice) on Nov 29, 2011 at 21:19 UTC

    Thanks - that seems to be what is happening, but it differs from what some of the perl docs say. eg:

    "Listen The Listen parameter is set to the maximum number of pending connections we can accept until we turn away incoming clients. Think of it as a call-waiting queue for your telephone. "


    The numeric argument to listen is the number of un accept ed connections that the operating system should queue before clients start getting "connection refused" errors.
      I just did a perldoc -f listen, which refers to man 2 listen.
Re^2: TCP server: How to reject connections when busy?
by andal (Hermit) on Nov 30, 2011 at 09:58 UTC

    Don't rely on this part. Different implementations behave differently. For example Linux treats backlog parameter 0 as 3. In either case, when the queue is full, then the system simply stops answering SYN packets, which triggers their resending. As result, the peer gets no indication that your server is busy. It simply keeps waiting for connection to be established.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://940664]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2016-10-24 01:06 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.