Detect When Network Cable Unplugged

user195488 picture user195488 · May 26, 2010 · Viewed 13.3k times · Source

Windows knows when you have removed the network cable from your NIC. Is there a programmatic way to determine this via API in C++?

Note: I am not using .NET and this is for a closed LAN (not connected to Internet ever)

Answer

Luke picture Luke · May 26, 2010

Raymond Chen blogged about something similar recently. Here is the relevant documentation. I think the MIB_IPADDR_DISCONNECTED flag is what you are looking for.