Common Causes of Connection reset by peer:
1) when the number of concurrent connections on the server exceeds its capacity, the server closes some of the connections;
If you know that the number of concurrent clients connecting to the server does not exceed the server capacity, it may be a virus or Trojan, causing network traffic exceptions. You can use netstat-An to view network connections.
2) The client closes the browser, and the server is still sending data to the client;
3) the browser presses stop;
These two cases generally do not affect the server. However, if the exception information is not specially processed, the exception may be repeated in the server's log file, resulting in the server's log file being too large and affecting the server's operation. Try... catch catch this exception, and then do not output or only output a prompt message, avoid using E. printstacktrace (); outputs all exception information.
4) Firewall problems;
If the network connection passes through the firewall, and the firewall usually has a timeout mechanism, when the network connection does not transmit data for a long time, the TCP session will be closed and then read and write, this will cause exceptions. If you disable the firewall and solve the problem, you need to reconfigure the firewall, or write your own program to implement TCP persistent connections. To achieve TCP persistent connections, you need to define the heartbeat protocol and send the heartbeat protocol at intervals. Both parties maintain the connection.
5) buffer issue of JSP.
The default JSP page cache is 8 KB. When the JSP page data is large, it is possible that JSP is not completely transmitted to the browser. You can adjust the buffer size. <% @ Page buffer = "100 K" %>
Common network exceptions (from http://www.cnblogs.com/kaixin110/archive/2008/04/11/1148671.html ):
The first exception is java.net. bindexception: address already in use: jvm_bind. This exception occurs on the server side for the new serversocket
(Port) (port is an integer value of) operation. The cause of the exception is that the same port has been started and listened. Use
Run the netstat-An command to view the port in the listending status. You only need to find an unused port to solve this problem.
The first exception is java.net. connectexception: Connection refused: connect. This exception occurs when a new socket (IP, Port) is performed on the client)
During the operation, the cause of the exception is that the machine with the IP address cannot be found (that is, from the current machine to the specified IP address route), or the IP address exists
But cannot find the specified port for listening. In this case, first check whether the client's IP address and port are written incorrectly. If yes, ping the server from the client.
Check whether the Ping is successful. If the Ping is successful (another method is required for the server to disable the ping), check whether the program listens to the specified port on the server.
Start, this will certainly solve this problem.
The first exception is java.net. socketexception: socket is closed, which can occur on both the client and server. The reason for the exception is that you have taken the initiative to close
After the connection is closed (the close method of socket is called), read and write the network connection.
The first exception is java.net. socketexception: (Connection Reset or connect reset by peer: Socket write error ). This exception
There are two possible causes for this exception on both the client and the server. The first one is if the socket at one end is closed (or active or because of exceptions ).
), And the other end still sends data. The first packet sent causes this exception (connect reset by peer ). The other is exit at one end.
But the connection is not closed when exiting. If the other end reads data from the connection, this exception (Connection Reset) is thrown ). Simply put, after the connection is disconnected
.
The first exception is java.net. socketexception: broken pipe. This exception may occur on both the client and server. In the first case of the 4th exceptions
(That is, after throwing socketaskton: connect reset by peer: Socket write error), if you continue writing data, this exception is thrown. First two differences
The common solution is to first ensure that all network connections are closed before the program exits, and then check the closing operation of the other party. After the other party closes the connection, it also needs
Close the connection.
Client error code 10053 software caused connection abort (software causes connection interruption)