I feel that the real intention that you are talking about is throttling, that is, for a specific client / connection, allowing only a fixed number of packets at a given time. This seems like a more realistic use case than allowing / denying more connections.
Most modern languages ββprovide some support, such as java or C #, but not c.
However, this is an elegant approach to its implementation. I myself used it in production code.
throttling implementation
source share