在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
C#获取本机IP搜集整理7种方法:http://blog.csdn.net/frombegintoend/article/details/7713097 使用IPHostEntry获取本机局域网地址 string hostName = Dns.GetHostName(); IPHostEntry localHost = Dns.GetHostEntry(hostName); for (int i=0; i < localHost.AddressList.Length ; ++i) { if (localHost.AddressList[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { Console.WriteLine(localHost.AddressList[i].ToString()); } }
|
请发表评论