Socket InputStream.available may return a positive value after shutdown

Chris Hegarty chris.hegarty at oracle.com
Wed Jul 13 14:13:28 PDT 2011



On 07/13/11 06:39 PM, Alan Bateman wrote:
> Jing LV wrote:
>> Hello,
>>
>> Alan (or anyone else), do we have time to discuss these postponed
>> defects? Or do you have a outlook for this?
>> Thank you.
> Sorry for the late reply, I've been on vacation.

Sorry, I also meant to respond. Just got lost in all the noise recently.

> I think now is a good time to discuss this one. As I mentioned in the
> initial discussion, the existing behavior is platform specific. Once
> shutdown for input, then the ioctl(FIONREAD) or equivalent will continue
> to return the number of bytes in the socket buffer, other platforms will
> return 0. Changing the implementation is trivial and the question is
> whether this is the right thing to do. We will also need to clarify the
> specification. Chris, Michael - do you have opinions on this one?

I can't see that anyone could be depending on the fact the available() 
would return > 0 after shutdownInput(), given that subsequent reads will 
always return -1. I just can't see why anyone would require this, but 
maybe I'm missing something.

-Chris.

>
> -Alan.



More information about the net-dev mailing list