tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: svn commit: r533881 - /tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
Date Thu, 03 May 2007 02:31:15 GMT
Remy Maucherat wrote:
> Filip Hanik - Dev Lists wrote:
>> correct, but what does available() return on a client disconnect, 
>> since in NIO it's detected as a read. Are we coding it such that when 
>> a read event happens, available() always return -1
>
> available() would return 1 if there's a read event sent for whatever 
> reason (meaning the servlet must read and continue reading until 
> available() returns <= 0), including a disconnect.
>
> It's never going to be perfectly accurate, I know, there are too many 
> buffers, including the native ones, and some are encoded ;) Where did 
> you see -1 (it should not be returning -1, it's either 0, 1, or some 
> slightly more accurate number if the buffer at the servlet layer 
> contains something) ?
forget my -1, that was for reading the OS buffer.
>
>
> If there are ways to properly detect disconnects (like APR apparently 
> does on Unix, but not on Windows) it would be much better. There are 
> hacks which could emulate it, like doing a read in CoyoteAdapter.event 
> before sending the read event, and modify the event accordingly (for 
> example, calling InputBuffer.realReadBytes to attempt filling the 
> first buffer and see if a horrible exception occurs would detect a 
> disconnect).
>
> Rémy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message