Report information from NetworkInterface : NetworkInterface : Network C# Examples


C# Examples » Network » NetworkInterface »

 

Report information from NetworkInterface









    
using  System;
using  System.Net.NetworkInformation;

class  MainClass
{
        static  void  Main()
        {
                if  (!NetworkInterface.GetIsNetworkAvailable())
                      return;

                NetworkInterface[]  interfaces  =  NetworkInterface.GetAllNetworkInterfaces();

                foreach  (NetworkInterface  ni  in  interfaces)
                {
                        
                        Console.WriteLine("Interface  Name:  {0}",  ni.Name);
                        Console.WriteLine("        Description:  {0}",  ni.Description);
                        Console.WriteLine("        ID:  {0}",  ni.Id);
                        Console.WriteLine("        Type:  {0}",  ni.NetworkInterfaceType);
                        Console.WriteLine("        Speed:  {0}",  ni.Speed);
                        Console.WriteLine("        Status:  {0}",  ni.OperationalStatus);
                }
        }
}
    
   
  
   



Output

Interface Name: Wireless Network Connection
    Description: Broadcom 802.11b/g WLAN - Packet Scheduler Miniport
    ID: {4FA13198-E7E5-4065-8395-EDC576EE1020}
    Type: Ethernet
    Speed: 54000000
    Status: Down
Interface Name: Local Area Connection
    Description: Realtek RTL8139 Family PCI Fast Ethernet NIC - Packet Scheduler Miniport
    ID: {0180EFAF-14BF-42AA-A274-6D8D766A0093}
    Type: Ethernet
    Speed: 100000000
    Status: Up
Interface Name: MS TCP Loopback interface
    Description: MS TCP Loopback interface
    ID: MS TCP Loopback interface
    Type: Loopback
    Speed: 10000000
    Status: Up


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» NetworkInterface