Peter Warren wrote:
Could you indulge me and try the client with the sleep?
just did, worked exactly as before.
event: BEGIN, subtype: null
event: READ, subtype: null
Read 10 bytes: comet test for session: A01334D0AC22505DCD4B323820963FEC
read error
event: ERROR, subtype: TIMEOUT
I see the end event when there's a break/delay between sending a chunk
and sending the last chunk.  It is legal http to send the last chunk
separately from preceding chunks, isn't it?

getting a -1 on a inputstream.read is normal (even for a regular servlet).

The "read error" indicates slightly more: that
inputstream.isAvailable() is >0 and that inputstream.read() returns
-1.  Do I understand correctly in thinking that this -1 can indicate
two different situations: 1) the client sent a last chunk; or 2) the
client socket closed while the server was reading?

isAvailable is only there so that you don't have to block the thread.
ie, isAvailable()>0 means that the thread will return directly from a read(byte[]). The return value of read(byte[]) is what you have to pay attention to, -1 does mean EOF (and if the transport is chunked, then yes, last chunk has been received) I can't recall on top of my head, but a real read error, would generate an IOException during read(byte[])
If the above is true, it might be nice to have a way to disambiguate
the two situations.  Also, documentation-wise, it might be nice to
comment the servlet code in
http://tomcat.apache.org/tomcat-6.0-doc/aio.html to indicate that the
-1 can occur on a last chunk as well as a read error.
see above.
As a new comet
user, I incorrectly took your sample code block (in the aio doc page)
below to mean that a -1 always indicated some kind of error:

} else if (n < 0) {
  error(event, request, response);
  return;
}
yes, we are very aware that the sample code is not the best for getting started, we are looking to replace it, but it takes time and resources. contributions always welcome!
Filip
Thanks,
Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to