C#/.NET获取本机的IP地址

System.Net.IPHostEntry ips = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
foreach (System.Net.IPAddress ip in ips.AddressList)
{
    Console.WriteLine(ip.ToString());
}

 

posted @ 2011-03-11 22:23  逆时针  阅读(2158)  评论(0编辑  收藏  举报