I thought it was retrieve at compile time from /proc/sys/net/core/somaxconn,but after I modified it to 1024 by echo 1024 > /proc/sys/net/core/somaxconn,the SOMAXCONN is still 128 in my programe.
printf("---------------set socket to listen,maxconn is %d--------------\r\n\r\n", SOMAXCONN);
// set socket to listen
if (listen(sock_listen, SOMAXCONN) != 0)...
I’ve checked sys/socket.h but it’s not there…
Where/how can I change its value?
On my system it’s defined in
bits/socket.hAccording to this, you don’t need to use SOMAXCONN. Just specify number you want and it will be limited to actual maximum.