-
Bug
-
Resolution: Fixed
-
P4
-
6, 7
-
b06
-
generic
-
generic, linux
-
Verified
This thread on the net-dev list:
http://mail.openjdk.java.net/pipermail/net-dev/2011-January/002607.html
highlights the issue that it's not cler what Socket.getInputStream().available() should return when the Socket's input has been shutdown with shutdownInput.
With the default SocketImpl then available() will return the number of bytes in the socket buffer but that may be confusing as those bytes cannot be read. It may be tempting to change the implementation to return 0 but this could potentially break applications that would otherwise read EOF. Also it may not be possible to do that anyway because it's not clear how alternative SocketImpls behave. One possibility is to add a clarification (in both Socket#getInputStream and Socket#shutdownInput) to say that the return value from available() is SocketImpl specific when the input is shutdown, it may or may not return the number of bytes in the socket buffer.
http://mail.openjdk.java.net/pipermail/net-dev/2011-January/002607.html
highlights the issue that it's not cler what Socket.getInputStream().available() should return when the Socket's input has been shutdown with shutdownInput.
With the default SocketImpl then available() will return the number of bytes in the socket buffer but that may be confusing as those bytes cannot be read. It may be tempting to change the implementation to return 0 but this could potentially break applications that would otherwise read EOF. Also it may not be possible to do that anyway because it's not clear how alternative SocketImpls behave. One possibility is to add a clarification (in both Socket#getInputStream and Socket#shutdownInput) to say that the return value from available() is SocketImpl specific when the input is shutdown, it may or may not return the number of bytes in the socket buffer.
- duplicates
-
JDK-6726928 SocketInputStream.available() method does not return 0 when it reaches end of file on Linux
-
- Closed
-