How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the \'My\' structure. Than
If you want to monitor for changes in the status, use the System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged event:
NetworkChange.NetworkAvailabilityChanged
+= new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
_isNetworkOnline = NetworkInterface.GetIsNetworkAvailable();
// ...
void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
{
_isNetworkOnline = e.IsAvailable;
}