wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Nio : How to close a socket channel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Nio : How to close a socket channel" Watch "Nio : How to close a socket channel" New topic

Nio : How to close a socket channel

Kris Adams

Joined: Jul 02, 2004
Posts: 17
I am using socket channel for communication (created as shown below). Each time i use it, i am closing by invoking socketChannel.close(). But this doesnt seem to be closing the tcp connection.

SocketChannel socketChannel = SocketChannel.open();
socketChannel.connect(new InetSocketAddress(ip, port));

Can someone sugg the right way to terminate the connection.
J Kneeland
Ranch Hand

Joined: Aug 15, 2004
Posts: 31
Joe Ess

Joined: Oct 29, 2001
Posts: 8836

This question belongs in the Sockets and Internet Protocols forum.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
jQuery in Action, 2nd edition
subject: Nio : How to close a socket channel
Similar Threads
Question regarding the SocketChannel
SocketChannel And Socket Shutdown/recycle
Please verify if i understand NIO Selectors
nio and http request
detect disconnetced socketchannel on writes