Lấy IP của 1 trang web
Đoạn mã lấy IP của 1 máy trong mạng Lan, hay IP của 1 trang web.
string host = "www.sqlvn.com";
try
{
IPAddress[] addresses = Dns.GetHostAddresses(host);
foreach (IPAddress addr in addresses)
{
Console.Write(addr+Environment.NewLine);
}
Console.ReadLine();
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
0 comments:
Post a Comment