Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by JavaFan (Canon)
on Nov 29, 2011 at 17:42 UTC ( [id://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:
    http://perldoc.perl.org/perlipc.html#Sockets%3a-Client%2fServer-Communication

    "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. "

    or

    http://docstore.mik.ua/orelly/perl/cookbook/ch17_03.htm

    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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-24 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found