what do SOMAXCONN mean in C socket programming?

后端 未结 2 834
南笙
南笙 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:21

    Simply put, the backlog is the maximum number of queued connections you want on a socket.. This queue is there so you can handle a connection from a client while others wait in line, the backlog specifies how long you want this line to be. if more clients attempt to connect to your server, more than the backlog, those connections will be dropped.

    SOMAXCONN defines the maximum number you're allowed to pass to listen() which is 128 on my system.

    You can read more about it in the man page

提交回复
热议问题