Common causes of Connection reset by peer

Source: Internet
Author: User
Tags connection reset
Common reasons for Connection reset by peer:
1 The number of concurrent connections to the server exceeds its load capacity, and the server closes some of the connections;
If you know that the actual number of concurrent clients connected to the server does not exceed the server load, it may be a virus or trojan, causing network traffic anomalies. You can use Netstat-an to view network connectivity.
2 customers shut down the browser, and the server is still sending data to the client;
3 browser End Press stop;
Both of these situations generally do not affect the server. However, if the exception information is not specifically handled, it is possible in the server's log file, repeat the exception, causing the server log files too large, affecting the server's operation. You can use Try...catch to catch the exception that is causing the exception, and then do not output or output only one hint message, avoid using e.printstacktrace (), and output all exception information.
4) The problem of the firewall;
If the network connection through the firewall, and the firewall will generally have a time-out mechanism, when the network connection for a long time does not transfer data, will shut down this TCP session, after the shutdown in read and write, will cause an exception. If you turn off the firewall, fix the problem, reconfigure the firewall, or write your own program to implement a long connection to TCP. To implement a long connection to TCP, you need to define your own heartbeat protocol, which sends a heartbeat protocol at a time, and the two sides maintain the connection.
5 JSP buffer problem.
JSP page Default cache 8k, when the JSP page data is larger, it is possible that the JSP is not fully passed to the browser. The size of the buffer can be adjusted appropriately. <%@ page buffer= "100k"%>

Common network exceptions (from http://www.cnblogs.com/kaixin110/archive/2008/04/11/1148671.html):
The 1th exception is java.net.BindException:Address already in Use:jvm_bind. This exception occurs on the server side for the new ServerSocket

(Port is a 0,65536 integer value) operation. The reason for the exception is that one of the ports like Port has been started and is listening. At this time with

Netstat–an command, you can see a port with a listending state. You can solve this problem by looking for a port that is not occupied.


The 2nd exception is Java.net.ConnectException:Connection Refused:connect. The exception occurs when the client makes a new Socket (IP, port)

Action, the exception occurs because a machine with an IP address cannot be found (that is, it does not exist from the current machine to the specified IP route), or if the IP exists

, but the specified port could not be found for listening. This problem occurs, first check whether the IP and port of the client is wrong, and if correct, ping the server from the client

See if you can ping, if you can ping (the service server to ping off the need for another way), then look at the server-side listening to the specified port program whether

Start, this will definitely solve the problem.


The 3rd exception is the Java.net.SocketException:Socket is closed, which can occur on both the client and the server. The reason for the exception is the active shutdown

After the connection is closed (the Close method of the socket is invoked), the network connection is read and write.


The 4th exception is java.net.SocketException: (Connection reset or Connect reset by Peer:socket write error). The exception

This can occur on both the client and server side, causing the exception to be two, and the first is if the socket on one end is closed (or actively closed or due to a different

Often exits, the other end sends data, and the first packet that is sent throws the exception (Connect reset by peer). The other is one end exit

, but the connection is not closed when you exit, and the other end throws the exception if you read the data from the connection (Connection reset). Simply put, after the connection is disconnected,

Read and write operations.


The 5th exception is Java.net.SocketException:Broken pipe. This exception can occur on both the client and the server. In the first case of the 4th exception

(That is, after you throw socketexcepton:connect reset by Peer:socket write error), throw the exception if you continue to write the data. Top two different

The common solution is to first ensure that the program before exiting all network connections, followed by detection of the other side of the shutdown connection operation, found that the other closed the connection after they have to

Closes the connection.

Client error code 10053 Software caused connection abort (software causes connection interruption)

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.