Search code examples
c#compact-frameworknetwork-programmingwindows-ceethernet

Detecting network state (connected - disconnected) in C#


I am in need of a piece of code that can detect if a network connection is connected or disconnected. The connected state would mean a cable was plugged into the Ethernet connection. A disconnected state would mean there is not cable connected.

I can't use the WMI interface due to the fact that I'm running on Windows CE. I don't mind invoking the Win32 API but remember that I'm using Windows CE and running on the Compact Framework.


Solution

  • Check out this MSDN article:

    Testing for and Responding to Network Connections in the .NET Compact Framework