原生socket使用问题
服务端主动断开socket,socket.close客户端怎么知道,客户端那边是会报io异常吗 ?
服务端主动断开socket,socket.close客户端怎么知道,客户端那边是会报io异常吗 ?
2016-07-14
Exception in thread "main" java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) 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 Socket.Client.main(Client.java:18) 会报这个异常。。。你可以敲一下代码试试
举报