1.7.3.3 drop connection every 30 seconds

View: New views
9 Messages — Rating Filter:   Alert me  

1.7.3.3 drop connection every 30 seconds

by Jeanfrancois Arcand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[From my blog]

Hi Jean-Francois,

I'm new to Grizzly and Java NIO. I downloaded this example and test it.
Im impressed by how easy you can put a server on. I also slightly
modified the client example in order to loop for a very long period of
time and I observed some behavior that I don't know if its right. 1.
With the latest grizzly-framework-1.7.3.3 the connection is dropped
after 30 seconds. Even if there is activity on the channel, I got a
java.nio.channels.ClosedChannelException while the client was trying to
send data to the server. I tried to modify the serverTimeout,
selectTimeout and socketTimeout on the TCPHandler but i saw no change.
2. I tested with the grizzly-framework-1.7.0 and there is no such
problem as the connection is not dropped if the client is doing some
activity. However, if no activity the connection is dropped after 30
seconds. Could you give me some hints on how to configure the different
timeouts? I actually need a server that keeps connections alive for very
long perdiods of tine.

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Parent Message unknown Re: 1.7.3.3 drop connection every 30 seconds

by John ROM :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
in grizzly the default on an idle connection is set to 30 seconds.

if you need longer connections you need to have code like this ,of course on both sides
client and on server

TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();

 DefaultSelectionKeyHandler keyHandler = new DefaultSelectionKeyHandler();
  //keep connection for example for  30 minutes or whatever you need
 keyHandler.setTimeout(30 * 1000 * 60);
 tcpSelectorHandler.setSelectionKeyHandler(keyHandler);
 controller.addSelectorHandler(selectorHandler);

does this help?

Greetings john

--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 1.7.3.3 drop connection every 30 seconds

by Jeanfrancois Arcand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

And I've replied...


Hi,

I've posted your question to the grizzly's user list:
users@... and cc-ed you By default, Grizzly close idle
connection after 30 seconds. You can configure this number by overriding
the DefaultSelectionKeyHandler.expires() method like this:

    class SharedSelectionKeyHandler extends DefaultSelectionKeyHandler {
          @Override
          public void expire(Iterator keys) {
          } // The connections are never going
    }

Thanks!

-- Jeanfrancois

Jeanfrancois Arcand wrote:

> [From my blog]
>
> Hi Jean-Francois,
>
> I'm new to Grizzly and Java NIO. I downloaded this example and test it.
> Im impressed by how easy you can put a server on. I also slightly
> modified the client example in order to loop for a very long period of
> time and I observed some behavior that I don't know if its right. 1.
> With the latest grizzly-framework-1.7.3.3 the connection is dropped
> after 30 seconds. Even if there is activity on the channel, I got a
> java.nio.channels.ClosedChannelException while the client was trying to
> send data to the server. I tried to modify the serverTimeout,
> selectTimeout and socketTimeout on the TCPHandler but i saw no change.
> 2. I tested with the grizzly-framework-1.7.0 and there is no such
> problem as the connection is not dropped if the client is doing some
> activity. However, if no activity the connection is dropped after 30
> seconds. Could you give me some hints on how to configure the different
> timeouts? I actually need a server that keeps connections alive for very
> long perdiods of tine.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Parent Message unknown Re: 1.7.3.3 drop connection every 30 seconds

by John ROM :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Laugh , I missed the blog note...
this happens when you programm 12 hours a day (-:

I just thought you are on the road therefore might not have any time for
answers.

Greetings John
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 1.7.3.3 drop connection every 30 seconds

by survivant :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

there is a way to disabled to timeout ?  In my application the connections have to stay open around 8-10 hours without deconnection.. it's a real-time stock application.. we can't accept to be disconnected.

and by the way John.. thanks for your reply on my demo.  I'll check it this weekend. 




2008/6/5 John ROM <snake-john@...>:
Hi,
in grizzly the default on an idle connection is set to 30 seconds.

if you need longer connections you need to have code like this ,of course on both sides
client and on server

TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();

 DefaultSelectionKeyHandler keyHandler = new DefaultSelectionKeyHandler();
 //keep connection for example for  30 minutes or whatever you need
 keyHandler.setTimeout(30 * 1000 * 60);
 tcpSelectorHandler.setSelectionKeyHandler(keyHandler);
 controller.addSelectorHandler(selectorHandler);

does this help?

Greetings john

--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: 1.7.3.3 drop connection every 30 seconds

by Jeanfrancois Arcand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



John ROM wrote:
> Laugh , I missed the blog note...
> this happens when you programm 12 hours a day (-:
>
> I just thought you are on the road therefore might not have any time for
> answers.
>

Many thanks John!!! Keep the answer coming :-)

A+

-- Jeanfrancois


> Greetings John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 1.7.3.3 drop connection every 30 seconds

by Jeanfrancois Arcand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Salut,

Survivant 00 wrote:
> there is a way to disabled to timeout ?  In my application the
> connections have to stay open around 8-10 hours without deconnection..
> it's a real-time stock application.. we can't accept to be disconnected.

Just to makes sure. Are you using Grizzly Comet or just the NIO
framework (too much travel this week :-)) ? If you are using the NIO
framework, you will need to disable the timeout to avoid Grizzly closing
it after 30 seconds idle times.

>
> and by the way John.. thanks for your reply on my demo.  I'll check it
> this weekend.

Yes big big thanks to John!!!

A+

-- Jeanfrancois


>
>
>
>
> 2008/6/5 John ROM <snake-john@... <mailto:snake-john@...>>:
>
>     Hi,
>     in grizzly the default on an idle connection is set to 30 seconds.
>
>     if you need longer connections you need to have code like this ,of
>     course on both sides
>     client and on server
>
>     TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();
>
>      DefaultSelectionKeyHandler keyHandler = new
>     DefaultSelectionKeyHandler();
>      //keep connection for example for  30 minutes or whatever you need
>      keyHandler.setTimeout(30 * 1000 * 60);
>      tcpSelectorHandler.setSelectionKeyHandler(keyHandler);
>      controller.addSelectorHandler(selectorHandler);
>
>     does this help?
>
>     Greetings john
>
>     --
>     Psssst! Schon vom neuen GMX MultiMessenger gehört?
>     Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@...
>     <mailto:users-unsubscribe@...>
>     For additional commands, e-mail: users-help@...
>     <mailto:users-help@...>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: 1.7.3.3 drop connection every 30 seconds

by survivant :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

just NIO framework.  go take a good day off and come back in shape and found answer to all my problems :)



2008/6/5 Jeanfrancois Arcand <Jeanfrancois.Arcand@...>:
Salut,


Survivant 00 wrote:
there is a way to disabled to timeout ?  In my application the connections have to stay open around 8-10 hours without deconnection.. it's a real-time stock application.. we can't accept to be disconnected.

Just to makes sure. Are you using Grizzly Comet or just the NIO framework (too much travel this week :-)) ? If you are using the NIO framework, you will need to disable the timeout to avoid Grizzly closing it after 30 seconds idle times.



and by the way John.. thanks for your reply on my demo.  I'll check it this weekend.

Yes big big thanks to John!!!

A+

-- Jeanfrancois






2008/6/5 John ROM <snake-john@... <mailto:snake-john@...>>:


   Hi,
   in grizzly the default on an idle connection is set to 30 seconds.

   if you need longer connections you need to have code like this ,of
   course on both sides
   client and on server

   TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();

    DefaultSelectionKeyHandler keyHandler = new
   DefaultSelectionKeyHandler();
    //keep connection for example for  30 minutes or whatever you need
    keyHandler.setTimeout(30 * 1000 * 60);
    tcpSelectorHandler.setSelectionKeyHandler(keyHandler);
    controller.addSelectorHandler(selectorHandler);

   does this help?

   Greetings john

   --
   Psssst! Schon vom neuen GMX MultiMessenger gehört?
   Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

   ---------------------------------------------------------------------
   To unsubscribe, e-mail: users-unsubscribe@...
   <mailto:users-unsubscribe@...>

   For additional commands, e-mail: users-help@...
   <mailto:users-help@...>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: 1.7.3.3 drop connection every 30 seconds

by Sebastian Pavel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes it helps a lot. Thanks.

This was my first touch with Grizzly.  I am considering building a client-server appplication on top of Grizzly but as the documentation lacks it is very difficult to understand how it really works.

Thanks again.

John ROM wrote:
Hi,
in grizzly the default on an idle connection is set to 30 seconds.

if you need longer connections you need to have code like this ,of course on both sides
client and on server

TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler();

 DefaultSelectionKeyHandler keyHandler = new DefaultSelectionKeyHandler();
  //keep connection for example for  30 minutes or whatever you need
 keyHandler.setTimeout(30 * 1000 * 60);
 tcpSelectorHandler.setSelectionKeyHandler(keyHandler);
 controller.addSelectorHandler(selectorHandler);

does this help?

Greetings john

--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@grizzly.dev.java.net
For additional commands, e-mail: users-help@grizzly.dev.java.net