mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Query regarding keep alive
Date Thu, 30 May 2013 07:29:56 GMT
Le 5/30/13 8:48 AM, Saurav Gulati a écrit :
> I am relying on the session idle event to detect if a client got
> disconnected (in case of un-graceful connection break). To do this I have
> added logic to my TCP clients to send a "keep alive" message every 2
> seconds. And I have configured the server to detect idle events using
> acceptor.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 2);
>
> When I get 3 consecutive idle events - my server logic assumes that the
> client is disconnected and closes the session. I get the count using
> int readerIdleEventCount = session.getReaderIdleCount();
>
> Is the above logic the right way to handle my scenario? 

Basically, yes.

> I want to
> understand when I should use READER_IDLE/WRITER_IDLE/BOTH_IDLE?
MINA can detect sessions getting idle in both ways (read and write). In
your case, it's probably enough to use the READER event. (I'm not even
sure if it makes sense at all to check the WRITE idling anyway..)

Hope it helps.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Mime
View raw message