Strange Exception at read
Alan Bateman
Alan.Bateman at Sun.COM
Sat Nov 14 02:31:57 PST 2009
向雅 wrote:
> :
> Seems not merely "reset by peer".
>
> I mention the story:
> for the error "PASV" case, At the same read request, there are different result:
> 1-->immediately read, get windows AccessDenied error.
> 2-->sleep(1000), get exception, "remote server closed connection".
>
> pseudo code like this:
> WriterCompletionHandler{
> void complete(Integer result, attachment){
> if(buffer.hasremaining())
> doWrite();
> else{
> //2 Thread.sleep(1000), //just test one connection so not care the
> group thread pool's execution. get closed-exception
> readBuffer();//1immediately read, get access-exception
> }
> }
> }
>
> Read or not, two type exceptions, real strange, real msh.
> In my view, even if access-denied occurs, the channel still readable,
> rather than closed.
>
You should find that the channel is still open - it's the connection
that is terminated (abruptly) by the operating system/firewall.
I probably shouldn't have mentioned the "reset by peer" case as that
isn't really anything to do with the issue that you are running into.
Instead, I was just saying that this is the one case that comes to mind
where it could be useful for the read/write operations to fail with a
more specific IOException.
-Alan.
More information about the nio-dev
mailing list