my dog learned polymorphism
The moose likes Sockets and Internet Protocols and the fly likes SocketChannel And Socket Shutdown/recycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SocketChannel And Socket Shutdown/recycle" Watch "SocketChannel And Socket Shutdown/recycle" New topic

SocketChannel And Socket Shutdown/recycle

Ahmed Basheer
Ranch Hand

Joined: Apr 15, 2004
Posts: 77
I am using Java NIO Sockets and am looking for a way to actually shutdown the tcp socket without closing the SocketChannel. I found method "socketShutdownInput" and "socketShutdownOutput" but they really don't disconnect the socket connection. Right after calling these method if you invoke SocketChannel.isConnected you will get true. Is this bug in Socket NIO or is there actually way to "diconnect", opposite in action to method "connect" on SocketChannel object which will only recyle the socket connection without closing the channel. The problem is if you close the channel then that channel needs to go through all the methods again like open, register etc...

Your suggestions or ideas would be appreciated.

I agree. Here's the link:
subject: SocketChannel And Socket Shutdown/recycle
It's not a secret anymore!