You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Trustin Lee <tr...@gmail.com> on 2007/09/28 21:29:56 UTC

Re: IoSession reconnect

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