pending read/failed callback/IOException
Alan.Bateman at Sun.COM
Wed Apr 22 14:06:58 PDT 2009
Leon Finker wrote:
> You're correct. This exception has nothing to do with asynchronous close.
> The client terminates abruptly, and that's when the exception happens. Is
> this correct behavior? Is it safe to assume that for tcp:
> 1. -1 result on the asynchronous read callback specifies remote end graceful
> shutdown (or shutdownInput has been called)
> 2. IOException will happen in failed() callback when remote end closed
> connection abruptly
The behavior you observe is expected. That is, -1/EOF to mean that you
can reached end of stream (connection closed gracefully). IOException to
mean that the read operation failed.
More information about the nio-dev