IP零碎知识总结

1

(1) 获取本地IP:

string HostName = Dns.GetHostName(); //获取主机名          
IPHostEntry MyEntry = Dns.GetHostByName(Dns.GetHostName()); //获取有关ip信息
IPAddress MyAddress = new IPAddress(MyEntry.AddressList[0].Address);//获取ip

你可能感兴趣的:(总结)