问答详情
源自:3-2 编程实现基于 TCP 的 Socket 通信之服务器端

什么情况,出现异常

Exception in thread "main" java.net.SocketException: Connection reset

at java.net.SocketInputStream.read(SocketInputStream.java:209)

at java.net.SocketInputStream.read(SocketInputStream.java:141)

at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)

at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)

at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)

at java.io.InputStreamReader.read(InputStreamReader.java:184)

at java.io.BufferedReader.fill(BufferedReader.java:161)

at java.io.BufferedReader.readLine(BufferedReader.java:324)

at java.io.BufferedReader.readLine(BufferedReader.java:389)

at socket.socket1.main(socket1.java:21)


提问者:慕田峪9146975 2016-05-16 13:18

个回答

  • 疲惫的程序猿
    2016-05-16 15:11:06
    已采纳

    是不是没有调用socket.shutdownOutput()方法,关闭输出流