Exemple #1
0
 // ===========================================
 // Internal and debug log related stuff
 // ===========================================
 internal static void PrintInterfaceInfos()
 {
     NetDebug.WriteForce(NetLogLevel.Info, "IPv6Support: {0}", NetSocket.IPv6Support);
     try
     {
         foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
         {
             foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses)
             {
                 if (ip.Address.AddressFamily == AddressFamily.InterNetwork ||
                     ip.Address.AddressFamily == AddressFamily.InterNetworkV6)
                 {
                     NetDebug.WriteForce(
                         NetLogLevel.Info,
                         "Interface: {0}, Type: {1}, Ip: {2}, OpStatus: {3}",
                         ni.Name,
                         ni.NetworkInterfaceType.ToString(),
                         ip.Address.ToString(),
                         ni.OperationalStatus.ToString());
                 }
             }
         }
     }
     catch (Exception e)
     {
         NetDebug.WriteForce(NetLogLevel.Info, "Error while getting interface infos: {0}", e.ToString());
     }
 }