Error #10054 in socket program

Source: Internet
Author: User
Tags connection reset

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.