On 4/4/07, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
Hi,

The pages on Comet say the following about the read event:

EventType.READ: This indicates that input data is available, and that
one read can be made without blocking. The available and ready methods
of the InputStream or Reader may be used to determine if there is a risk
of blocking: the servlet should read while data is reported available,
and can make one additional read without blocking. When encountering a
read error or an EOF, the servlet MUST report it by either returning
false or throwing an exception such as an IOException. This will cause
the error event to be invoked, and the connection will be closed. It is
not allowed to attempt reading data from the request object outside of
the execution of this method.

However, I just got a READ event where available() returns 0 (because
the next byte to read would be -1 indicating the end of the stream).

Is there any way to test for the end of the stream without calling read() ?

Ok, that javadoc is a little bit out of date (ex: returning false).
However, it is still valid: if you get a read event, you're supposed
to do at least one read, and it could return -1 (if it got that from
the client). If it fails to read data because the client disconnected,
you'll get an IOException.

Rémy

---------------------------------------------------------------------
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