我需要得到系统,其中应用程序是由C#代码
运行的IP地址IPAddress[] ip = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress theaddress in ip)
{
String _ipAddress = theaddress.ToString();
}
我正在使用此代码,但这是在不同的操作系统中给出不同的结果。例如,在Windows 7中,它提供了“fe80 :: e3:148d:6e5b:bcaa%14”
以及它给出“192.168.10.93”的Windows XP。
听起来像一个家庭作业的问题。 – Wildhorn 2010-08-25 18:15:40
可能的重复http://stackoverflow.com/questions/1069103/how-to-get-my-own-ip-address-in-c – Robb 2010-08-25 18:16:29
Dupe http://stackoverflow.com/questions/1069103/how-to -get-my-own-ip-address-in-c – 2010-08-25 18:16:51