8217461: (ch) Add Net.available to return the number of bytes in the socket input buffer
Alan Bateman
Alan.Bateman at oracle.com
Wed Jan 23 10:35:28 UTC 2019
On 23/01/2019 09:42, Florian Weimer wrote:
> :
> 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?
>
Not planning for available to read. The long standing behavior in this
area is for SIS.available to consistently return 0 after a connection
reset has been detected. This is of course awkward to replicate in a new
implementation as it requires detecting connection reset, something that
was never implemented in the SocketChannel implementation (mostly
because it's highly platform/implementation specific as to how read
behaves when attempt after a connection reset).
-Alan
More information about the net-dev
mailing list