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

close socket  RSS feed

Ariffin Ahmad
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i opened a connection to a socket server..
then, i send something using os.println("some command") and after that i read the response using is.readLine(). but, something happen to the server. the server hang, without giving any reponse. because i've already setSoTimeout(5000), a timeout exception is thrown. the problem comes when i tried to close the connection using os.close(); is.close(); sock.close();.
no exception being thrown, but, somehow, i know the real connection to the server is not closed. it will only closed when i shut down the JVM. what should i do in order to really closed the connection, and closing JVM is not my option, because i run this code within Tomcat's servlet....
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!