C#得到本机的本机IP
/// <summary>
/// 獲取本機ip
/// </summary>
/// <returns></returns>
public static string getLocalIP()
{
string strHostName = Dns.GetHostName(); //得到本机的主机名
IPHostEntry ipEntry = Dns.GetHostByName(strHostName); //取得本机IP
string strAddr = ipEntry.AddressList[0].ToString();
return (strAddr);
}
本文出自 “狼之魂” 博客
补充:软件开发 , C# ,