问答详情
源自:3-4 完善用户登陆之服务器响应客户端

java.net.SocketException: Connection reset

多线程的第一次运行没问题,第二次就开始报错了

java.net.SocketException: Connection reset

at java.net.SocketInputStream.read(Unknown Source)

at java.net.SocketInputStream.read(Unknown Source)

at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)

at sun.nio.cs.StreamDecoder.implRead(Unknown Source)

at sun.nio.cs.StreamDecoder.read(Unknown Source)

at java.io.InputStreamReader.read(Unknown Source)

at java.io.BufferedReader.fill(Unknown Source)

at java.io.BufferedReader.readLine(Unknown Source)

at java.io.BufferedReader.readLine(Unknown Source)

at com.MyChatSystem.server.Client.main(Client.java:30)


提问者:1D 2018-07-01 10:30

个回答

  • 电子153
    2018-08-22 15:33:32

    客户端是关闭输出流socket.shutdownOutput();

  • 好想学会HelloWorld
    2018-07-10 21:08:44

    先启动服务端,再启动客户端,链接重置了

  • AlphaSmartGo
    2018-07-03 11:51:41

    没有关闭吧