M
mattpryor
Hello,
I have a strange intermittent socket error occuring; stacktrace
follows:
23:22:01|1|java.net.SocketException (Socket operation on nonsocket:
recv failed)
23:22:01|1| at java.net.SocketInputStream.socketRead0(Native
Method)
23:22:01|1| at
java.net.SocketInputStream.read(SocketInputStream.java:129)
23:22:01|1| at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
23:22:01|1| at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
23:22:01|1| at
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
23:22:01|1| at
java.io.InputStreamReader.read(InputStreamReader.java:167)
23:22:01|1| at java.io.BufferedReader.fill(BufferedReader.java:136)
23:22:01|1| at
java.io.BufferedReader.readLine(BufferedReader.java:299)
23:22:01|1| at
java.io.BufferedReader.readLine(BufferedReader.java:362)
Here is a code snippet that is causing it:
ServerSocket server = new ServerSocket (PORT);
Socket socket = server.accept();
BufferedReader br = new BufferedReader (new
InputStreamReader(socket.getInputStream()));
String s = br.readLine();
The error occurs when attempting to read from the SocketInputStream on
the last line.
Oddly, although this Exception is thrown on the server and I'm
subsequently closing the client Connection in a finally clause, the
client does not seem to notice that anything is wrong, and so waits
indefinitely for the remainder of the conversation.
Any tips on how to avoid this, or what may be causing it?
Thanks in advance
Matt Pryor
I have a strange intermittent socket error occuring; stacktrace
follows:
23:22:01|1|java.net.SocketException (Socket operation on nonsocket:
recv failed)
23:22:01|1| at java.net.SocketInputStream.socketRead0(Native
Method)
23:22:01|1| at
java.net.SocketInputStream.read(SocketInputStream.java:129)
23:22:01|1| at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
23:22:01|1| at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
23:22:01|1| at
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
23:22:01|1| at
java.io.InputStreamReader.read(InputStreamReader.java:167)
23:22:01|1| at java.io.BufferedReader.fill(BufferedReader.java:136)
23:22:01|1| at
java.io.BufferedReader.readLine(BufferedReader.java:299)
23:22:01|1| at
java.io.BufferedReader.readLine(BufferedReader.java:362)
Here is a code snippet that is causing it:
ServerSocket server = new ServerSocket (PORT);
Socket socket = server.accept();
BufferedReader br = new BufferedReader (new
InputStreamReader(socket.getInputStream()));
String s = br.readLine();
The error occurs when attempting to read from the SocketInputStream on
the last line.
Oddly, although this Exception is thrown on the server and I'm
subsequently closing the client Connection in a finally clause, the
client does not seem to notice that anything is wrong, and so waits
indefinitely for the remainder of the conversation.
Any tips on how to avoid this, or what may be causing it?
Thanks in advance
Matt Pryor