Socket operation on nonsocket...?

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
 
M

mattpryor

Just for extra information:

JVM: 1.4.2_10
OS: Windows 2000 5.00.2195 / SP4

Cheers,
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top