mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fernando C. de Castro" <ferna...@altriz.com.br>
Subject detection of lost connection when it doesn't close "cleanly"
Date Sat, 16 Sep 2006 01:54:27 GMT

   I looked in the archive before posting this and couldn't find an answer, so please excuse
me if it has already been commented.

   I was wondering if there is a way to detect a lost connection when the other side doesn't
close the connection "cleanly". 

   Actually the server I wrote with MINA takes connections from GPRS modules and eventually
sends messages to some of them. The matter is that sometimes the GPRS modules face some network
problem and lose their IP session. When that happens, MINA (or the Operating System, for that
matter) takes a long time (many minutes) to realize the connection is gone. 

   I am aware that there are means to adjust this delay within the OS, but I was expecting
MINA to check that for me. If MINA sends a string of bytes for which the TCP/IP stack never
got an ACK, I think MINA was supposed to know it. 

   Of course I could implement some kind of protocol to check for active connections: the
GPRS modules could periodically send some data, and sessionIdle() would point out the 'mute'
peers and then those sessions could be closed. But that isn't very much efficient, and also
the GPRS is charged by traffic and this approach would result in a high fixed cost for the

   I was hoping MINA could confirm that all bytes scheduled to be sent for a certain session
were actually received by the other party; if some bytes remain there after a Timeout, then
some event should be triggered.

   Is there any easy way to achieve this, and I'm still not able to see?

   Thanks in advance,


View raw message