Re: Checking if a connection is closed

  • From: Oleksiy Stashok <oleksiy.stashok@...>
  • To: users@...
  • Subject: Re: Checking if a connection is closed
  • Date: Mon, 16 Jun 2014 12:25:02 -0700

Hi Luis,

can you pls. share the code how you suspend the request processing?

Thank you.

WBR,
Alexey.

On 14.06.14 01:27, Luis Antunes wrote:
Hi Alexey,

Thanks for your reply. Basically, I want to support a subscribe-broadcast scenario. I am not interested in using WebSockets. This means I am keeping a reference to each Request and Response associated with each suspended client. The problem is that I don't know when to stop sending a broadcast to the suspended client. For that, I need to know if the suspended client is still connected. I hope this provides an idea of what I'm trying to do.

Also, I have tried reading and writing things using the available IO facilities provided by the Request/Response objects, but these also do not seem to throw any kind of Exception if the client is disconnected.

Thanks,
Luis




On Fri, Jun 13, 2014 at 5:57 PM, Oleksiy Stashok <oleksiy.stashok@... <mailto:oleksiy.stashok@...>> wrote:

    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






Checking if a connection is closed

Luis Antunes 06/13/2014

Re: Checking if a connection is closed

Oleksiy Stashok 06/13/2014

Re: Checking if a connection is closed

Luis Antunes 06/14/2014

Re: Checking if a connection is closed

Oleksiy Stashok 06/16/2014
Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150226.965aeb8)
 
 
Close
loading
Please Confirm
Close