Connection reset by peer Cause Analysis

Source: Internet
Author: User
Tags connection reset

I wrote a section in C LanguageProgram, Run on the client to request files on the server. Sometimes, when the send command is sent, the returned value of read is-1 and the errno value is Connection reset by peer.

In the TCP mechanism, both parties of the socket connection can call functions such as close () to exit the current connection. Based on the improved three-way handshake mechanism, TCP notifies the other party to exit the current connection. This process can be seen as part of a normal socket connection.
At the same time, TCP provides a reset mechanism to send a reset packet to the other party after a program disconnects the connection in case of an exception. Reset is to immediately exit and clear all resources related to this connection.
Therefore, Connection reset by peer occurs because the peer server unexpectedly exits the connection.

In this case, the client only needs to reconnect to the server. In this case, sometimes I have to try again about five times to connect normally.

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.