In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "error reporting JAVA.NET.SOCKETEXCEPTION: SOFTWARE CAUSED CONNECTION ABORT: RECV FAILED how to solve", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "error reporting JAVA.NET.SOCKETEXCEPTION: SOFTWARE CAUSED CONNECTION ABORT: RECV FAILED how to solve" it!
There are many reasons for this exception, as shown in Software caused alone.
It is caused by programming problems, not network problems.
A scenario that is known to cause this exception is as follows:
The client and the server establish a short connection to tcp, and the client sends a request each time
The server closes the connection with the client after responding.
If the client does not release the connection after the server closes the connection, it continues to try to send the request and receive the response.
Things will go wrong at this time.
The OutPutStream maintenance returned by the getOutputStream of the client Socket at this time
Is the local connection status
It is impossible to know that the remote server has shut down the corresponding InputStream and socket, so
Although it called the
Out.write (sendbuf, 0, sendbuf.length)
Method, but in fact, the server does not receive the request information from the client.
Because no exception is thrown, it creates a false impression that the client request was sent successfully.
Next, call the in.read (header, 0,14); method of etInputStream.
Because this time we have to read the information from the server, it produces
Software caused connection abort: exception of recv failed
To sum up the cause, when the server / client unilaterally closes the connection, the other party still thinks
The tcp connection is still established, trying to read the other party's response data, resulting in
Software caused connection abort: the exception of recv failed.
Therefore, before receive data, it is necessary to determine the connection status.
Whether there is a response result is judged by the available () method of inputstream.
If the return value of available () is 0, there is no response data, and the other party may have been disconnected
If the return value of available () is greater than 0, there is response data.
It is also worth noting that the value returned by available () is non-blocking and can be accessed by multiple threads.
After the other party releases the connection, also release the local connection
Thank you for your reading, the above is the content of "error reporting JAVA.NET.SOCKETEXCEPTION: SOFTWARE CAUSED CONNECTION ABORT: RECV FAILED how to solve". After the study of this article, I believe you have a deeper understanding of how to report error JAVA.NET.SOCKETEXCEPTION: SOFTWARE CAUSED CONNECTION ABORT: RECV FAILED to solve this problem, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.