The TCP connection drops after quickly unplugging and replugging the Ethernet cable

Peng 0 Reputation points
2026-10-13T12:18:52.1633333+00:00

My PC is running Windows 10, acting as a TCP client that communicates with a controller functioning as the TCP server. After I quickly unplugged and reconnected the Ethernet cable, the TCP connection was already disconnected, and the system could no longer find this connection entry.

Packet capture results show that after the cable was reconnected, the controller sent data packets to the PC, but the PC responded with an RST (reset) packet.

Why does unplugging and replugging the network cable cause the TCP connection to drop? What methods can be used to keep the TCP connection persistently connected?

Windows for business | Windows Client for IT Pros | Networking | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Tracy Le 13,690 Reputation points Independent Advisor
    2026-10-14T15:05:13.0166667+00:00

    Hello Peng,

    Windows has a cross-layer feature called Media Sense: when the NIC driver reports link-down, the IP stack marks the interface disconnected and aborts every TCP connection bound to it. That’s why your packet capture shows RST, and why I said no supported fix exists, which was too absolute.

    The difference between your two PCs is most likely here. Run netsh interface ipv4 show global on both and compare the DHCP Media Sense line. Also compare Get-NetIPAddress -AddressFamily IPv4 (PrefixOrigin Dhcp versus Manual) and the NIC model and driver version, since some drivers don’t report very short link drops to Windows at all.

    On the affected PC, run netsh interface ipv4 set global dhcpmediasense=disabled from an elevated prompt and test again. That keeps the address and connections in place during a brief unplug, though your application should still have reconnect logic as a safety net.

    Tracy Le.

    Was this answer helpful?

    0 comments No comments

  2. Tracy Le 13,690 Reputation points Independent Advisor
    2026-10-13T13:58:06.4033333+00:00

    Hello YS P,

    What you are seeing is expected TCP behavior. When the Ethernet link is unplugged, Windows detects a physical link loss and the existing TCP session becomes invalid. After the cable is reconnected, the controller may still believe the session exists and continue sending data, but the Windows TCP stack no longer has a matching connection state, so it responds with a TCP RST packet.

    In practice, there is no supported way to guarantee that a TCP session survives an actual link-down event caused by unplugging the network cable. The recommended approach is for the client application to detect the disconnection and automatically establish a new TCP connection when network connectivity returns.

    If reconnection needs to happen quickly, consider implementing TCP keepalives, application-level heartbeats, or automatic reconnect logic in the client software. Those mechanisms are typically used in industrial control and telemetry applications where temporary network interruptions are expected.

    If this helps, please accept the answer.

    Tracy Le.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.