You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Steven <xi...@126.com> on 2007/11/16 10:27:02 UTC

How to terminate the tcp connection?

 
 
 
 Hi,

I'm not sure is it proper to ask a question about nio in this mailing list since this question is not concerns MINA and maybe be quite basic.

So please ignore this mail if such questions are not allowed in this mailing list and I will not send mails like this again.

Here is my problem:

I'm using the nio to write a server-side programme.
After the client has connected to the server and has communicated with the server, I want to close the socketchannel and terminate
the tcp connection form the server-side while the client didn't call the SocketChannel.close meathod or do somethins else to disconnect from the server.

So, I call the SocketChannel.close() in the programme, but this doesnt seem to be closing the tcp connection. 
Through a firewall software , I found that the tcp connection is still there.

So I call the SocketChannel.socket().close() and then call the SocketChannel.close(), but the tcp connection is still there.

And then I try to do some reading and writing through the socketchannel and the socket after calling the two close methods , but all I got is an exception and the tcp connection is still there.

Can someone suggest the right way to terminate the connection?

Thank you very much!

Steven