Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SocketChannel And Socket Shutdown/recycle  RSS feed

Ahmed Basheer
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!