Strange Exception at read

向雅 fyaoxy at gmail.com
Fri Nov 13 15:03:29 PST 2009


2009/11/13 Alan Bateman <Alan.Bateman at sun.com>:
> 向雅 wrote:
>>
>> :
>> BTW, Alan, what about the exception translate class?
>>
>
> There is clearly merit in looking at the "reset by peer" case so that the
> application can distinguish this from other I/O exceptions. I think folks
> using SocketChannel and legacy Socket would appreciate that too. The case
> for doing something with "access denied" is less clear (to me anyway) and I
> don't expect we'll define a specific exception for that.
>
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.

Regards,
qinxian


More information about the nio-dev mailing list