c++csocketstcplisten

How to determine the value of socket listen() backlog parameter?


How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number?


Solution

  • From the docs:

    A value for the backlog of SOMAXCONN is a special constant that instructs the underlying service provider responsible for socket s to set the length of the queue of pending connections to a maximum reasonable value.