tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rémy Maucherat" <>
Subject Re: Another Comet 6.0.10 question
Date Wed, 04 Apr 2007 15:21:16 GMT
On 4/4/07, Sebastiaan van Erk <> 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.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message