users@grizzly.java.net

Re: Checking if a connection is closed

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Fri, 13 Jun 2014 14:57:06 -0700

Hi Luis,

unfortunately it might be related to OS or JDK socket implementation.
The only reliable way to check the socket status is to try to read or
write something.

Can you pls. provide more details on your usecase, may be we'll be able
to find a solution.

Thanks.

WBR,
Alexey.

On 13.06.14 14:37, Luis Antunes wrote:
> Hi,
>
> I'm implementing a Grizzly HttpHandler, and am wondering if there is
> any way to check if the client connection that originated the Request
> is still open, or if it has closed? I've tried obtaining
> the HttpRequestPacket from the Request, and checking if the Connection
> is open, but that seems to always return true, even if the client has
> disconnected.
>
> Any help would be much appreciated.
>
> Thanks!
> Luis