what do SOMAXCONN mean in C socket programming?

后端 未结 2 830
南笙
南笙 2021-02-04 03:00

I didn\'t understand anything about somaxconn in socket programming in C( Linux Ubuntu).I searched through several sites, but all those couldn\'t help me much.

l         


        
2条回答
  •  太阳男子
    2021-02-04 03:11

    #include 
    
    int listen (int socket, int backlog);
    

    The backlog argument provides a hint to the implementation which the implementation shall use to limit the number of outstanding connections in the socket's listen queue. Implementations may impose a limit on backlog and silently reduce the specified value. Normally, a larger backlog argument value shall result in a larger or equal length of the listen queue. Implementations shall support values of backlog up to SOMAXCONN, defined in .

    If listen() is called with a backlog argument value that is less than 0, the function behaves as if it had been called with a backlog argument value of 0.

    A backlog argument of 0 may allow the socket to accept connections, in which case the length of the listen queue may be set to an implementation-defined minimum value.

    As seen here.

提交回复
热议问题