gpt4 book ai didi

java - BufferedReader.readLine() 给出错误 java.net.SocketException : Software caused connection abort: recv failed

转载 作者:可可西里 更新时间:2023-11-01 02:55:07 24 4
gpt4 key购买 nike

我正在尝试对我的程序进行编码,以便缓冲读取器从我的 tcp 客户端获取 readLine() 中的内容,但是程序一执行我就收到此错误

   Mar 31, 2010 11:03:36 PM deswash.DESWashView$5 run
SEVERE: null
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at deswash.DESWashView$5.run(DESWashView.java:448)

下面代码中的car=in.readLine()报错

 public void getCar(){
Thread gettingCars = new Thread(){
@Override
public void run(){
try {
car = in.readLine();
if(!(car.equals(null))){
StringTokenizer st = new StringTokenizer(car,";");
int carTime = Integer.parseInt(st.nextToken());
finTime.setText(""+((Integer.parseInt(currentTime.getText()))+washTime));
currentTime.setText(""+carTime);
eventTextArea.append(""+car+"\n");
}
} catch (IOException ex) {
Logger.getLogger(DESWashView.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
gettingCars.start();
doOnce=false;
}

最佳答案

来自 MSDN:

WSAECONNABORTED (10053) Software caused connection abort

A connection abort was caused internal to your host machine. The software caused a connection abort because there is no space on the socket's queue and the socket cannot receive further connections.

WinSock description: The error can occur when the local network system aborts a connection. This would occur if WinSock aborts an established connection after data retransmission fails (receiver never acknowledges data sent on a datastream socket).

TCP/IP scenario: A connection will timeout if the local system doesn't receive an (ACK)nowledgement for data sent. It would also timeout if a (FIN)ish TCP packet is not ACK'd (and even if the FIN is ACK'd, it will eventually timeout if a FIN is not returned).

它似乎在 WindowsXP 中发生得更多,而且似乎也可能与 Windows 防火墙设置有关。在任何情况下,重点是中止起源于本地机器。

这是一条措辞愚蠢的消息。

关于java - BufferedReader.readLine() 给出错误 java.net.SocketException : Software caused connection abort: recv failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2557916/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com