日期:2014-05-18 浏览次数:20830 次
/// <summary> /// 获取本地Ip /// </summary> private string GetLocalIP() { IPHostEntry ipHostEntry = Dns.GetHostEntry(Dns.GetHostName()); if (ipHostEntry.AddressList.Length > 0) { foreach (IPAddress ipAddress in ipHostEntry.AddressList) { if (ipAddress.AddressFamily == AddressFamily.InterNetwork) { return ipAddress.ToString(); } } } return string.Empty; }
?