Home:ALL Converter>Can backlog value that is passed to listen() call be modified later on without clossing the listening socket in Winsock2 C++ on Windows?

Can backlog value that is passed to listen() call be modified later on without clossing the listening socket in Winsock2 C++ on Windows?

Ask Time:2020-09-25T00:08:50         Author:Ahmed

Json Formatter

First of, I have seen many questions related to backlog but known addresses the mystery whether a backlog value that has been initially set in a listen() call can be changed later on without closing the socket (and re-calling the bind() & listen())?

What I want to do is to dynamically change the backlog at runtime for my server application. At present, the server had issues with startup due to thundering herd problem (all clients attempt to connect at startup). There are 500 clients. To address this issue I reduced the backlog to 10. This has greatly helped the server to recover from the startup load. However, once the server has recovered I would like to enlarge the underlying queue by modifying the backlog value.

So, is there a way to change the backlog without closing the socket.

Thing that I saw over the internet which won't work is to make a second listen() call over the same listening socket by passing a different backlog value. This is clever thinking however the MSDN clearly states that it will have no effect on the backlog parameter.

Author:Ahmed,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/64050281/can-backlog-value-that-is-passed-to-listen-call-be-modified-later-on-without-c
yy