[ Team LiB ] |
9.7 Using DNSThe networking types in the base class library also support normal and reverse Domain Name System (DNS) resolution. Here's an example using these types: // DNSLookup.cs // Run DNSLookup.exe <servername> to determine IP addresses using System; using System.Net; class DNSLookup { static void Main(string[ ] args) { IPHostEntry he = Dns.GetHostByName(args[0]); IPAddress[ ] addrs = he.AddressList; foreach (IPAddress addr in addrs) Console.WriteLine(addr); } } |
[ Team LiB ] |