Posted on 2006-05-03
I'm facing a strange problem reading from the input-stream of a socket. If the socket on the other side is closed, inputStream.read () does not throw an IOException but simply waits, or sometimes reads a "?"
Anybody faced this before? Is this something new with Java 5? I'm running it on Windows 2003 Enterprise Server and the client for the server is also built in Java. I send bytes using outputStream.write () and later flush () it. On the server-side, I receive using inputStream.read (). If I deliberately close the client, the server thread either hangs, or sometimes reads some special character. The encoding used for data on both sides is the same (either UTF-8 or ASCII).
When I do a netstat, I can see that port shows me a TIME_WAIT. It should not be shown~! It should be disconnected.