Hi!

We have an application where we need to know if an user terminated the
connection with the server using the application(closing it) or if the
connection has been lost due to network issues. It's a game server, and we
want to let the user reconnect and have his status back if the connection is
lost, but not if the application was closed properly.

We're using a KeepAliveFilter to detect if the client is still responsive,
in the KeepAliveRequestTimeoutHandler we are closing the session and setting
an attribute "connection_lost" to this session, so on the sessionClosed of
our IoHandler implementation we can know if the disconnection was due to
keep-alive fail or not.

The problem is that we're having IOException by "Connection reset by peer"
sometimes when an user lose his connection, we are testing by unplugging the
network cable from a client machine.

We tried to set the "connection_lost" attribute in the exceptionCaught of
our IoHandler implementation, but after investigating MINA code we realize
that we cannot be sure if exceptionCaught would be invoked previously than
sessionClosed or not.

What can we do to detect the connection lost in all these cases?

[]'s
Moisés Rosa

Reply via email to