Created
June 9, 2022 16:08
-
-
Save st0le/beb983beb8e63f8ebc60ba89ed39d334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
foreach ( NetworkInterface netif in NetworkInterface.GetAllNetworkInterfaces() ) | |
{ | |
Console.WriteLine("Network Interface: {0}", netif.Name); | |
IPInterfaceProperties properties = netif.GetIPProperties(); | |
foreach ( IPAddress dns in properties.DnsAddresses ) | |
Console.WriteLine("\tDNS: {0}", dns); | |
foreach ( IPAddressInformation anycast in properties.AnycastAddresses ) | |
Console.WriteLine("\tAnyCast: {0}", anycast.Address); | |
foreach ( IPAddressInformation multicast in properties.MulticastAddresses ) | |
Console.WriteLine("\tMultiCast: {0}", multicast.Address); | |
foreach ( IPAddressInformation unicast in properties.UnicastAddresses ) | |
Console.WriteLine("\tUniCast: {0}", unicast.Address); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment