Software caused connection Abort:recv failed

Source: Internet
Author: User

Software caused connection Abort:recv failed

This error is sometimes reported when a database is connected. After the client establishes a short connection, the server closes the connection, but the client does not shut down and still attempts to send the request, an error occurs.

The description is as follows:

The client and the server make a short connection to TCP, and each time the client sends a request, the server closes the connection to the client after the service side responds. If the client does not release the connection after the server closes the connection, it continues to attempt to send the request and receive the response. This time it will be wrong.
This time the client socket Getoutputstream returned to the OutputStream to maintain the local connection state, do not know that the remote server has closed the corresponding inputstream and socket so that although the call Out.write ( SendBuf, 0, sendbuf.length); method, but actually the server does not receive the client's request information. Because there is no exception thrown, it creates the illusion that the client request was successfully sent.
Next Call Etinputstream's In.read (header, 0, 14); Because this time to read the server information, resulting in software caused connection Abort:recv failed exception
Summary of the cause, in the case of the service side/client unilaterally shut down the connection, the other side still think the TCP connection is still established, trying to read the response data of the other, resulting in software caused connection Abort:recv failed exception.
Therefore, before you receive data, you must first determine the connection status. The InputStream available () method is used to determine whether there is a response result. If the return value of available () is 0, there is no response data, it is possible that the other party has disconnected, and if the return value of available () is greater than 0, the response data is indicated. It is also worth noting that the value returned by available () is non-clogging and can be accessed by multiple threads
After the other party releases the connection, it also releases the local connection.

Another possibility is that the transmission Data protocol is inconsistent, and this error may be reported.

Software caused connection Abort:recv failed

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.