NetworkInterface: NetworkAvailabilityChanged event : NetworkInterface « Network « C# / C Sharp






NetworkInterface: NetworkAvailabilityChanged event

 


using System;
using System.Net.NetworkInformation;
class MainClass {
    private static void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) {
        if (e.IsAvailable) {
            Console.WriteLine("Network Available");
        } else {
            Console.WriteLine("Network Unavailable");
        }
    }
    static void Main(string[] args) {
        NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
    }
}

 








Related examples in the same category

1.NetworkInterface: GetIPProperties
2.NetworkInterface: GetIPv4Statistics
3.NetworkInterface: GetPhysicalAddress
4.NetworkInterface: OperationalStatus
5.NetworkInterface:NetworkAddressChanged event
6.NetworkInterface: GetAllNetworkInterfaces
7.NetworkInterface: Name
8.NetworkInterface: Description
9.NetworkInterface: Id
10.NetworkInterface: NetworkInterfaceType
11.NetworkInterface: Speed