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

Socket appears connected even after closing the socket  RSS feed

 
om ganesh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Am running into a issue which is appearing strange to me


In this code I am explicitly closing the socket connection but then to "Socket.isConnected() " method returns true - "saying socket is still connected"

Could some one help me understand this behavior properly.

Thanks in advance,
Omganesh
 
Devaka Cooray
Marshal
Posts: 5564
711
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Socket.isConnected() method does not implies whether the socket is currently in connection with the remote. Instead it returns true if it has EVER been connected to the remote. Therefore it returns true, even after the connection is explicitly closed.

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