steve martin wrote:
>
> The client (browser) can disconnect the connection
> with the server by clicking the STOP or Reload button
> on the browser. When this happens, the server will not
> know and will keep processing the previous request
> from the client.
>

 There's no totally general way to detect this, mainly
because the browser doesn't have to be directly connected
to the server at all, but may be going through one or
more proxies. Or the browser may be connected to a front
end web server that's actually talking over a completely
separate socket connection to your back-end servlet server.
With intermediaries in the pipeline, it gets hard to
make guarantees.

 Assuming a direct connection, though, you might think
you should get a notification as soon as you try to
write back to the disconnected client, right? That's
actually your best bet, but it's not 100% either, since
the servlet container may be buffering up your output.
You might try the occasional "flush" and check to see
if you get an exception. If you write enough output
then you'll see the disconnection eventually.

 The suggestion to cheat and have some sort of client
side polling is reasonable if you absolutely 100%
have to know, otherwise you'll have to accept that
sometimes you're going to be calculating output for
disconnected clients.


--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to