8217461: (ch) Add Net.available to return the number of bytes in the socket input buffer
Florian Weimer
fweimer at redhat.com
Wed Jan 23 09:42:55 UTC 2019
* Alan Bateman:
> This is a small change to add a method to sun.nio.ch.Net to get the
> number of bytes in the socket input buffer. The motive for adding this
> to make it possible for the socket adaptors to implement
> InputStream::available and also to support an alternative SocketImpl
> based on NIO.
Do you plan to read from the socket buffer in the implementation of
available()? The problem is that even if there is currently data in the
socket buffer, further data that arrives later can clear it. I think
this can only happen as part of a connection reset. Maybe that's okay
because reading will not block, but throw an exception instead?
Thanks,
Florian
More information about the net-dev
mailing list