The static Dns class encapsulates the Domain Name Service.
Domain Name Service converts between a raw IP address, such as 66.15.12.87, and a human-friendly domain name.
The GetHostAddresses
method converts from domain name to IP address (or addresses):
using System;
using System.Net;
using System.Threading;
using System.IO;
using System.Text;
class ThreadTest
{
static void Main()
{
foreach (IPAddress a in Dns.GetHostAddresses("abc.com"))
Console.WriteLine(a.ToString());
}
}
The output:
199.181.132.250
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |