Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: TCP ESTABLISHED status even after network cable unplugged

11 Aug 2011   #1
kdolan

Windows XP 32 bit and Windows 7 64 bit
 
 
TCP ESTABLISHED status even after network cable unplugged

I have an 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.

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 W7 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 searched the 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 yet.

Ideas?

Thanks!
Kelly


My System SpecsSystem Spec
.
11 Aug 2011   #2
kdolan

Windows XP 32 bit and Windows 7 64 bit
 
 

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.
My System SpecsSystem Spec
11 Aug 2011   #3
ZyanWu

Windows 7 Enterprise x64 SP1
 
 

Be sure to backup your registry before attempting any modifications blablabla.

Did you modify this one?
Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"TcpTimedWaitDelay"=dword:0000001e
(it's in hexa)


If that doesn't work I've searched for a tool that will let you close a TCP connection. I've found wKillcx : close a TCP connection (for Windows)
My System SpecsSystem Spec
.

11 Aug 2011   #4
kdolan

Windows XP 32 bit and Windows 7 64 bit
 
 

Thanks for the reply. Yes, that was the registry entry I modified and it did not help.

I'm not sure the tool would help me and my situation. My application doesn't know the connection needs to or can be closed. It makes a call and in Window XP returns almost immediately if the cable has been unplugged but not in Windows 7. The end user experience of the application is expected to be ... when the network connection is lost, notify the user and take them offline which allows them to perform a subset of functions. The problem is in W7 because it takes so long to detect this that in the meantime the user tries to perform functions that require network access.

I've tried to take my application out of the loop by monitoring netstat output. Once my application creates the socket and I unplug the cable, in WXP the socket connection disappears from the netstat list whereas in W7 it remains as ESTABLISHED for about 5 minutes. Therefore, my conclusion is that it has nothing to do w/ my application per se but some difference between WXP and W7 or the network configuration.
My System SpecsSystem Spec
11 Aug 2011   #5
ZyanWu

Windows 7 Enterprise x64 SP1
 
 

Ah, I see. Well, that didn't work because TcpTimedWaitDelay is used for connections in the TIME_WAIT state not the ESTABLISHED state.

Imo*, I'd start by making a new method of detecting disrupted connections and take it from there. It's a one-time modification ('til Windows 8 comes out ) whereas modifying every PC you put your application on is not a one-time modification and could cause other problems unrelated to your application.

If you really want to go down the road with the registry change, here, read this: TCP/IP config. parameters I'm guessing that's your best bet.



__________
* in my oppinion.
My System SpecsSystem Spec
11 Aug 2011   #6
kdolan

Windows XP 32 bit and Windows 7 64 bit
 
 

Thanks for the advice. I started to think if what you just suggested is my only viable option. It just bugs me though that I can't find a reasonable explanation for the change in behavior.
My System SpecsSystem Spec
11 Aug 2011   #7
ZyanWu

Windows 7 Enterprise x64 SP1
 
 

The change is probably for reliability.
For example, let's say you're downloading a file and the connection breaks. And the example application is set to
a) cancel the download if the connection disappears
and b) keep retrying if the connection is still established.

This application will behave like this:
On WinXP, your download is canceled and you lose all your downloaded data.
On Win7, the example app keeps retrying until the connection resumes or the timeout expires. If it succeeds, the download is resumed.

That's one thing I could think of. Hope it kinda explains the change in behavior.
My System SpecsSystem Spec
Reply

 TCP ESTABLISHED status even after network cable unplugged




Thread Tools




Similar help and support threads
Thread Forum
Network cable unplugged
Hi, I suddendly have no more internet. When I look at the connections Local Area Connection status switches rapidly between Enable then goes to Network cable unplugged with about 2 second between each status. Its making the router light flicker it just wont stay on Enable. I tried to change...
Network & Sharing
A Network cable is Unplugged... XP w/SP3!!!
Error Getting... A network cable is Unplugged OK so, Brand new Office built, everything went smooth as a coffee tabel :p, well, except the network issue that is. :eek: :confused: Biostar A880G+ Mobo AMD PH II X4 955 Black Edition 3.2Ghz 4GB GSKILL F3-10666 RAM WD WD3000BLFS Velociraptor...
Network & Sharing
Network Cable Unplugged error: cable is plugged in
Hello, Since last night, my LAN connection has been giving me the error "Network cable unplugged." I have tried swapping the cable with another, swapping the ports on the router, restarting the router, power cycling the router, turning off the router and my computer and then turning them back...
Network & Sharing
Network cable unplugged message when using ethernet cable
Hi, I have a brand new Dell Precision Workstation with Windows 7 Professional 64 bit. I have not been able to connect to networks or the internet. It does not recognize that it is plugged into the network/internet via an ethernet cable. The computer has a Broadcom NetLink Gigabit Ethernet adapter...
Network & Sharing
Network cable unplugged
hello, I installed Windows 7 (x86) today, but have found some trouble with getting a Internet Connection. I'm using a dc-202 router. Windows doesn't detect any connections, and when going to network connections it says: Local area connections ; network cable unplugged (tho the cable IS...
Network & Sharing
Network cable unplugged
Hello, i've decided to try out windows 7 64bit. after fresh clean install i had an issue with drivers for my integrated network card, which i installed from CD i received when i've bought MB, which is ASUS P5B Deluxe with following network devices : Marvell 88E8056 PCIe 1x 1 Gbit/s LAN Marvell...
Network & Sharing


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:30.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App