winsock select reports an 10022 error (by a reason that is not obvious, need tcp/winsock guru help)
<p>Given (simplified piece of code):</p>

<pre><code>const timeval timeout = {100, 0};
for(;;)
{
    fd_set sockets = {2, {service, controlSocket}};
    const auto result = select(0, &amp;sockets, nullptr, nullptr, &amp;timeout);
    ...
    if (result &gt; 0 &amp;&amp; FD_ISSET(service, &amp;sockets))
    {
        auto workerConnection = accept(service, nullptr, nullptr);
        WSARecv(workerConnection, ...);
    }
}
</code></pre>

<p>where service is a socket in the listening state, controlSocket is the very first established incoming connection on service socket which is used for communication with manager.</p>

<p>Error 10022 happens only when any previously established worker connection is gracefully closed on a remote side. I emphasize <strong>this code works as supposed to work</strong> almost all time except worker application closes a connection, however, I don't claim that closing connection on a remote side can affect this behavior. I just noticed that this error happens exactly after closing connection by a remote side while service side reporting WAIT_CLOSE for one of the established connections. I repeat it again, this code works correctly, after an error on next cycle of the loop and until another socket is closed select works with no error at all. The number of error is equal to the number of established workerConnections.</p>

<p>Don't know is it important or not I test this code running manager, service, and worker applications on the same PC not using localhost instead I provide network name of the PC to establish connections. After establishing a connection with worker service application receives and sends data by the workerConnection asynchronously only.</p>

<p>Question: Due to it doesn't affect service functionality at all and I don't have any other WSA errors is it ok to ignore this error and avoid spamming logs about it or I miss something important and have to fix the issue? I suspect some kind of issue in WSA because error happens only in a very specific set of circumstances. Am I correct? </p>