• Post Reply Bookmark Topic Watch Topic
  • New Topic

class Socket 's big problem

 
Sun LiWei
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in jdk 1.4,the isClosed() and isConnected() methods of Sokcet class does't detect whether the tcp connection is closed by remote host.
Only if the client socket invoke the s.close(),the two methods will show right result. It seems there's no way to know whether the tcp connection is closed by remote host.
 
raimondas zemaitis
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
same situation in RMI (if remote server crashes, any attempt to invoke it hangs forever). Try to use pinging with timeout if that's what you want.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!