posted 16 years ago
So this problem is driving me crazy. I have one little program where I open a Socket, send a byte for 'P' and then do a readLine...this works perfectly fine 100% of the time.
I now have a different program where I've put the bit of working code to get the data from a server (from my other program) which is part of a much larger system. I SEEM to do the send ok (no exceptions), but as soon as the readLine() gets called, I get the following:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
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)
Here's the two methods that get called (Note: getOutputStream() and getInputStream() get the i/o stream of the open socket:
So in one case, it works fine...in the other case, it never works...with practically the exact same code. I have a feeling I'm missing something blatantly obvious, but I don't know what to look for or where to start.
Any ideas?