On 9/4/06, Kok Hoor (Gmail) <[EMAIL PROTECTED]> wrote:
Hi,
There is this slight issue that I face with Mina. It is a minor issue only
though.
I am using Windows XP as the development and testing environment, and I
have
three separate instances of Mina running, one is the Server simulator,
another is the Proxy and the last is the Client simulator. When I press
Ctrl-C in the Proxy, and the Proxy terminates, the Client, which uses an
IOConnector, and is still sending messages to the Proxy will receive an
exception from the Proxy:
java.io.IOException: An existing connection was forcibly closed by
the remote host
My exceptionCaught function will close the Session. The code for my
function
is below:
public void exceptionCaught( IoSession session, Throwable cause )
{
SessionLog.info( session, "SxCommServerSessionHandler::Exception:"
+
cause);
cause.printStackTrace();
// close the connection on exceptional situation
session.close();
}
However, I still need to wait for around 10 - 30 seconds before my client
application exits. I have already inserted 'session.isClosing()' calls
before doing writes to prevent future writes from blocking the close. Is
it
due to NIO? Or is there anything I can do to explicitly to increase my
client shutdown time? It is funny because using conventional Java sockets,
I
do not this problem.
Well, usually, all servers should provide a way to shut itself down
gracefully such as:
1) unbind the port
2) close all connections
3) exit
It is a little bit weird that you are getting the exception even if you
terminated the server with CTRL+C. It is usually thrown when you killed a
process with -9 option.
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6