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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to