How to get BACKLOG of listening socket How to get BACKLOG of listening socket nginx nginx

How to get BACKLOG of listening socket


ss -lt gives this value in the Send-Q column.


id use the current backlog information to manage the number of connections received BECAUSE I can respond to the incoming connections and tell the sender to modify their connection interval, thus reducing (or increasing) load. I cannot control how many incoming connections I get but I can control how frequently they connect, hence keeping the backlog down and preventing timeouts on incoming connections.

in my case this happens to be a feature of the incoming connection source firmware, so it might be unique to my situation and not relevant to others.


There is no standard TCP API for getting the backlog. There is also no reason to need it. You created the socket, you put it into listen state, you should know what backlog you specified. Th system is entitled to adjust it up or down, but even then there is nothing useful you can do you with that information in your application.