c# 取本地ip地址
public static System.Net.IPAddress[] GetIpAddress()
{
string hostName = System.Net.Dns.GetHostName();// 获得主机名
System.Net.IPAddress[] ip = System.Net.Dns.GetHostAddresses(hostName);//获取ip信息及IP地址
return ip;
}
用ip地址GetIpAddress()[1].ToString(); 取下标1