Search code examples
javaqueueserversocketbacklog

Check number of connections in the queue of a server socket in Java


I have a Java program that creates a server socket and accepts connections from various clients.

I am interested in finding out the number of connections that are in queue (waiting to be processed by the server). I have used the default constructor without specifying the backlog parameter.

At runtime, is it possible to know how many connections are pending for the server?

I want to implement a monitor process, which will check how full the queue is and based on that, trigger clone processes for load balancing (so that the connections are not dropped).


Solution

  • According to this SO answer, you can't.