aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes TCP ESTABLISHED status even after network cable unplugged Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "TCP ESTABLISHED status even after network cable unplugged" Watch "TCP ESTABLISHED status even after network cable unplugged" New topic
Author

TCP ESTABLISHED status even after network cable unplugged

Kelly Dolan
Ranch Hand

Joined: Jan 08, 2002
Posts: 109
Note: I posted this on a Windows 7 forum and have not gotten much response. I realize this may not be a Java issue but I'm hoping someone may understand my problem and know what to do about it.


I have a Java application that establishes a socket connection w/ another application on a different machine. When this connection is disrupted (e.g., pull out network cable), I recognize this condition and take some action.

The application creates a Socket object, sets keep alive to true an then calls ObjectInputStream.readUnshared(). This call "hangs" until the server returns something or it times out. In the case when the network connection is disrupted and the call returns as a result...

In a Windows XP 32-bit environment, this happens quickly ... in seconds.

In a Windows 7 64-bit environment, this happens slowly ... in about 5 minutes.

If I run netstat in the Windows 7 environment, the TCP connection shows ESTABLISHED for about 5 minutes after the network cable has been unplugged. (In WXP, it changes in seconds.)

I've googled, searched both the Microsoft and this forum and have heard a few people refer to 5 minutes as being a "default" timeout value. I've also looked at the TCP spec, etc. to learn a bit more, understand it better, etc. in an attempt to find something I can configure to reduce the 5 minutes to seconds but I've not run into anything that works. I found documentation for a registry entry named TcpTimedWaitDelay for the TCP/IP service. It describes the default to be 240 seconds (4 minutes) and suggests it be set to 30. In the W7 environment, this entry was not set so I added it and restarted the machine. This did not work.

Ideas?

Thanks!
Kelly
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TCP ESTABLISHED status even after network cable unplugged
 
Similar Threads
cable modem linux and of course a newbie
Two network cards on linux
How to know that my system have Internet connectivity through JAVA
please answer this 128 questions for WLS. Urgently!