What is the best way to determine if there is a network connection available?
+36
A:
You can check for a network connection in .NET 2.0 using GetIsNetworkAvailable():
System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()
To monitor changes in IP address or changes in network availability use the events from the NetworkChange class:
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
Mitch Wheat
2009-02-06 13:53:25