users@grizzly.java.net

RE: Persistent tcp connection

From: Etienne Carouy <etienne.carouy_at_market-ip.com>
Date: Thu, 26 Jun 2008 15:43:53 +0200

Finally I found the option in Object DefaultSelectionKeyHandler.

 

DefaultSelectionKeyHandler selection = new DefaultSelectionKeyHandler();

selection.setTimeout(XXXX);

tcpSelector.setSelectionKeyHandler(selection);

 

This allows setting expiration time to a bigger value. It seems to work.

 

Any better idea?

 

 

 

  _____

De : Etienne Carouy [mailto:etienne.carouy_at_market-ip.com]
Envoyé : jeudi 26 juin 2008 14:41
À : users_at_grizzly.dev.java.net
Objet : Persistent tcp connection

 

Hi all,

 

I’ve working on an application that needs to manage a lot of socket in Java
and was interested in Grizzly.

The application is a GPRS server that received message from mobile device.
The connection is persistent because the device sent about 1 message / 5
minutes and that connection on GPRS network isn’t free.

Currently, the application use normal socket and each device connected
consume one thread (more than 1000 threads).

 

I made some tests with grizzly but I got java.net.SocketException:
Connection reset by peer: socket write error.

This happens when the device sent a first message and wait 5 minutes to send
the second one. I suppose that the server close the connection because of no
sufficient activity.

 

Is it possible to force the connection to stay open on the server side?

 

Thanks in advance for your answer.

 

Etienne Carouy