Java error - software caused connection abort: recv failed

Full error:

java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.net.SocketInputStream.read(SocketInputStream.java:121) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:154) at java.io.BufferedReader.readLine(BufferedReader.java:317) at java.io.BufferedReader.readLine(BufferedReader.java:382) at chat.run(chat.java:76) at java.lang.Thread.run(Thread.java:722) 

"in chat.run (chat.java:76)" is the line:

 System.out.println("[_in_"+(line=ins.readLine())+"_]"); 

a string is a string and is not a BufferedReader

 ins = new BufferedReader(new InputStreamReader(_sock.getInputStream())); 

_sock

 Socket _sock = null; _sock = serv_sock.accept(); 

This happens on my java server and not on my java client ... Also, this happens when I do not send anything for a while

----- EDIT ------

I tried again; At first he went for 40 minutes, doing nothing, and he was still working, then I waited 40 minutes again, and this time it did not work.

This seems to be a random case. I can not understand what causes it.

I have files * [client.java], [chat.java], [vlc.java] * [server.java], [chat.java], [vlc.java]

vlc files are the same for both, although the chat is different (since I have not done Threads on both the client and the server)

Here is the code;

  SERVER server.java: pastebin.com/GH8ShcGp chat.java : pastebin.com/iaL23kSb vlc.java : pastebin.com/9kyrbh5q CLIENT client.java: pastebin.com/HDK450Jg chat.java : pastebin.com/CfHrEUkE vlc.java : pastebin.com/SfZgYy58 

I think this is a window / network. Someone who can help me fix this?

+4
source share
3 answers

I could not get your exact problem for replication on my own computer using code and localhost connections, but after reading "BufferedReader.readLine () throwing java.net.SocketException: the software caused a connection interruption: recv failed" on several different pages I believe this is related to your network. The connection seems to be terminated due to TCP timeout or data corruption in transmission.

If this happens through localhost connections (server and client on the same computer), it may be faulty memory, otherwise you may have a broken nic, router, or cable somewhere along the line. If you use wireless, they can be pretty unreliable.

+5
source

This error occurs precisely because of a network problem. This happens when the connection to your database fails, and the application cannot receive the required data. The problem may be with your wired connection or with the modem. Try changing them. Otherwise, check access to the database in the sql developer, etc. If it works fine, there may be a problem with the transaction timeout.

0
source

There are two possibilities:

  • The database is down, or
  • The database server IP address duplicates the existing server IP address on the network.
-2
source

Source: https://habr.com/ru/post/1393382/


All Articles