C# 获得本机IP

System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(Environment.MachineName);
string strIP = "";
for(int i=0;i<ips.Length;i++)
{
    strIP += ips[i].ToString();
}
this.TextBox1.Text = strIP;

posted on 2008-06-13 15:01  freeliver54  阅读(1689)  评论(5编辑  收藏  举报

导航