If your server application has issued a blocking read using API recv(...), which should be in blocking mode before this problem happens, then, as soon as max retries, 5, is reached, the tcp/ip driver will reset that connection. You'll see that the recv() operation returned with errno 10054. This reset will come from local TCP/IP stack not from remote peer. The following example shows a thread doing the recv() , but this could be done anywhere in your code, (e.g main function).
DWORD WINAPI MyReceiver(VOID threadArg)
{
INT nRet = 0;
while(1)
{
nRet = recv(......); // blocks if no data available
if(nRet <= 0)
{
// handle error
printf("recv() failed, errno %d\n",WSAGetLastError());
}
} // end of while
}
If keep alive max retries was reached, you "should" see something like this:
recv() failed, errno 10054
Hope it helps. |