In a network project recently developed using winSock, a multi-threaded network program is written using TCP + Socket connection. The function is that the client is responsible for continuously sending data to the server, and the server is responsible for receiving data. The client is a DLL, and the server program is a random starting NT Service Program.
During the unattended operation of the program at night, the client often displays the error code 10054, but the server does not have the corresponding prompt. The running environment is win2000 + sp4, which is rather confusing.
Check the error code 10054 on MSDN. Description: WSAECONNRESET (10054)
Connection reset by peer.
A existing connection was forcibly closed by the remote host. this normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, or the remote host used a "hard close" (see setsockopt for more information on the SO_LINGER option on the remote socket .)
That is to say, a connection is reset by the other party. A established connection is forcibly closed by the remote host. If the process on the remote host is terminated abnormally (due to memory conflicts or hardware faults), or the socket is forcibly closed once, the error 10054 is returned. You can use the SO_LINGER socket option and setsockopt to configure a socket for forced shutdown.
However, it is still unclear why the connection is reset in the program. Further checks and debugging are required to solve this problem.