What does the "backlog" argument in the ServerSocket constructor mean?
Tim RohalyWhen a client requests a connection and the queue is full, the request will fail with a ConnectionException. Increasing this backlog value may prevent some refused connections, but won't help to process these connections any faster and doesn't affect the maximum number of simultaneous connections allowed.
A server must:
- Invoke the accept() method of ServerSocket to listen for a socket connection request
- Process the client request or hand off that request to a child process
ServerSocket tries to set the backlog to be 50 by default, although some OSes don't support a queue that large or don't allow the queue length to be modified.