This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes class Socket 's big problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "class Socket Watch "class Socket New topic

class Socket 's big problem

Sun LiWei
Ranch Hand

Joined: Aug 10, 2002
Posts: 49
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

Joined: Feb 23, 2001
Posts: 104
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.
I agree. Here's the link:
subject: class Socket 's big problem
It's not a secret anymore!