You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Murat OZDEMIR <mu...@dekateknoloji.com> on 2007/02/08 16:16:15 UTC

IoSession reconnect

Hi everybody,
 
I'm writing a server application which communicates mobile units on the
area.
Mobile units connects to server and send their datum. Because of the
mobility despite IP is same, sometimes session is closed. 
Server sends messages to the units using the IoSession object for each
client. But if session.isConnected() == false, server cannot send.
 
How can server reconnect the client using current session object?
 
Thanks for your interest
 
Murat OZDEMiR

Re: IoSession reconnect

Posted by Trustin Lee <tr...@gmail.com>.
On 2/9/07, Murat OZDEMIR <mu...@dekateknoloji.com> wrote:
>
> Hi everybody,
>
> I'm writing a server application which communicates mobile units on the
> area.
> Mobile units connects to server and send their datum. Because of the
> mobility despite IP is same, sometimes session is closed.
> Server sends messages to the units using the IoSession object for each
> client. But if session.isConnected() == false, server cannot send.
>
> How can server reconnect the client using current session object?

There's no way to reuse a closed session.  Instead, you can add an
IoFutureListener to the CloseFuture of the session:

session.getCloseFuture().addListener(new IoFutureListener() { ...
reconnect ... });

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6