Connection Reset, Connection reset by peer, software caused connection abort: Socket write error

Source: Internet
Author: User
Tags connection reset

Connection Reset, Connection reset by peer, software caused connection abort: Socket write error

Java.net. socketexception: Connection reset by peer: Socket write error
Java.net. socketexception: Connection Reset
Java.net. socketexception: Software caused connection abort: Socket write error

Java.net. socketexception: Software caused connection abort: Recv failed

Please tell me when reading from a socket connection how an ioexcption with "Connection Reset" message can occur.
I am basically connecting to a Windows server program.
Now I am using this exception for detecting invalid user login
So I want know that what are the other ways this exception can occur,

Please help me.
Thanks and regards
Haix

Http://forum.java.sun.com/thread.jspa? Threadid = 560591 & messageid = 2755358

Http://forum.java.sun.com/thread.jspa? Threadid = 430179 & messageid = 4429682

Http://forum.java.sun.com/thread.jspa? Threadid = 609696 & messageid = 3341613

I use Java to implement a program for sending and receiving text messages from SGIP.
However, during the receiving process, since China Unicom sends the deliver command, it takes 16 seconds to send the unbind command. At this time, it is thrown as a program on the server.
Java.net. socketexception Connection reset error!
Because when I receive data, inputstread. read (Bytes []) is a blocking function. If the input stream is not received, it will be blocked, but the error message should be that the socket has been disconnected. So I was surprised that this problem was not solved after a week. Please help me!

 

Http://topic.csdn.net/u/20080319/10/0285f5b9-5035-4022-8c3a-5ddc18637777.html

Connection reset by peer
The server segment of the web program is reset by the same "peer" when connecting to the database. The reset of the Peer point actually means that the access is forcibly occupied by the same administrator or program with the same permission, as if the current connection is disconnected. In fact, the connection is not closed at this time, it is reset. The connection can be found, but the program is too stupid to find the lost connection.
"The connection is reset by peer." In this case, you only need to disable the firewall. That is to say, the previous connection cannot be found for the time being. It may be disconnected, maybe not, but it cannot be found.

 

10053 the software in your host abandons an established connection.
//////////////////////////////////////// //////
A connection established by the user is terminated by software on the host, probably because of one data
Transmission timeout or protocol error. Also, do not send messages in Connection events.

 

Summary:
1. There is no space in your socket queue
2. Cycler never acknowledges data sent on a datastream socket (the recipient does not acknowledge the data sent on the data stream interface)
3. A connection will timeout if the local system doesn't receive an (ACK) nowledgement for data sent

Connection reset by peer
The exception thrown may also be that the client interrupts the connection. The server also throws this exception when the client is disconnected.

That is to say, when the client is connected, the connection is suddenly terminated. In this way, the server will throw a Connection reset by peer exception.

Http://topic.csdn.net/u/20080402/16/7fe0a9c2-cef5-4756-8c45-157555cd0097.html

The first exception is java.net. socketexception: (Connection Reset or connect reset by peer: Socket write error ). This exception may occur on both the client and server. There are two reasons for this exception, the first one is that if the socket at one end is closed (or the socket is closed actively or caused by abnormal exit), the other end still sends data, the first packet sent causes this exception (connect reset by peer ). The other end exits, but does not close the connection when exiting. If the other end reads data from the connection, this exception (Connection Reset) is thrown ). In short, it is caused by read and write operations after the connection is disconnected.

 

Http://topic.csdn.net/u/20080328/10/e08d894a-319a-4985-8407-50e103305e6c.html

 

I have some suggestions on network exceptions. Let's talk about them:
The first exception is java.net. bindexception: address already in use: jvm_bind. This exception occurs when the server performs 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 monitored. 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 the client performs the new socket (IP, Port) operation, the cause of this exception is that the machine with the IP address cannot be found (that is, the current machine does not exist to the specified IP address route), or the IP address exists, but the specified port cannot be found 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 to check whether the server can be pinged, if the Ping is successful (the server can disable the ping operation, you need another method). Check whether the program on the specified port of the server listener is started. This will definitely solve this problem.

The first exception is java.net. socketexception: socket is closed, which can occur on both the client and server. The exception occurs when you close the connection (call the socket close method) and perform read/write operations on the network connection.

The first exception is java.net. socketexception: (Connection Reset or connect reset by peer: Socket write error ). This exception may occur on both the client and server. There are two reasons for this exception, the first one is that if the socket at one end is closed (or the socket is closed actively or caused by abnormal exit), the other end still sends data, the first packet sent causes this exception (connect reset by peer ). The other end exits, but does not close the connection when exiting. If the other end reads data from the connection, this exception (Connection Reset) is thrown ). In short, it is caused by read and write operations 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 4th exceptions (that is, after throwing socketaskton: connect reset by peer: Socket write error), if you continue writing data, this exception is thrown. The solution to the first two exceptions is to first ensure that all network connections are closed before the program exits, and secondly, to detect the closing operation of the other party, you need to close the connection after you find that the Peer closes the connection.

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

 

Another problem is the blocking function and non-blocking function, blocking socket and non-blocking socket.

One is the blocking function, and the other is the non-blocking function. The so-called blocking function means that it does not allow the program to call another function before completing the specified task. In Windows, it will also block the sending of messages in this thread. A non-blocking function is a function that returns a result immediately after the operation is started. Otherwise, an error message indicating that the result needs to be waited is returned without waiting for the task to complete.

Http://www.aka.org.cn/Lectures/002/Lecture-2.1.8/Lecture-2.1.8/new_page_15.htm

Http://www.cppblog.com/kenlistian/archive/2007/12/27/39746.html

Http://hi.baidu.com/evenque/blog/item/1ccfc63ffc3527c17d1e7188.html

Http://www.cic.tsinghua.edu.cn/jdx/lunwen/WinSockx.htm

 

Connection ResetBy peerCause:
FrequentConnection ResetBy peer: there may be many reasons, but the more common reasons are:
①: When the number of concurrent connections on the server exceeds its capacity, the server will shut down some of the connections;
②: The client closes the browser, and the server is still sending data to the client;
③: The browser presses stop.
Many people say that it is caused by the client and there is no way to control it. This is a depressing problem.

 

The cause of this problem is that the server connection has been reset, and the client still receives and sends data through the connection, and searches the Internet for this error, I found that most of the causes of this error were firewall reasons. Hey hey, I learned another trick.

 

Summary of socket, NiO socket and NiO socket framework Mina

Windows Sockets error codes

Http://msdn2.microsoft.com/en-us/library/ms740668.aspx

Socket communication has communication rules. If you want to maintain a persistent connection, there should be a communication protocol, including write/0, which is also part of the rule. After a file is uploaded, wait for the next one. to maintain persistent connections, you can use WebService, so that your protocol becomes more readable and easier to package into products.

It seems that your program wants to end the read, not to maintain a persistent connection.

 

Frequent Connection reset by peer: there may be many reasons, but the more common reasons are:
①: When the number of concurrent connections on the server exceeds its capacity, the server will shut down some of the connections;
②: The client closes the browser, and the server is still sending data to the client;
③: The browser presses stop.
Many people say that it is caused by the client and there is no way to control it. This is a depressing problem.

 

This is caused by network connection disconnection. Generally, the firewall has a timeout mechanism. When the network connection does not transmit data for a long time, the TCP session is cut off, this will cause Connection reset by peer error.

 

Http://topic.csdn.net/t/20060915/12/5024325.html

 

Communication between non-blocking Io and blocking io-input stream

Communication between non-blocking Io and blocking io-output streams

Add the latest conclusion of the problem
1. I used myeclipse single-step debugging. When debugging to inputstream, I checked the variables and found a problem,
That is, the channel of socketinputstream is null. Why? I don't know.

Find a few more words on the network and paste them here! As follows:

"No buffer space available, Recv failed"

Thank you, sandyen (shanye). I also found this on the internet, but this is not the reason.
The problem has been solved. It is indeed not a program problem.
Netstat-An finds that a large number of ports are occupied and listens to port 139,445 of many machines.
Make sure that the machine is in shock wave, download the patch, install and restart, and solve the problem.
The cause of this exception is that a large amount of system socket resources are occupied,
As a result, there are not enough resources to receive data reported or replied by the front-end.

Http://topic.csdn.net/t/20060315/11/4615627.html

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.