如何知道当前pc的外部ip地址

时间:2010-05-02 10:30:38

标签: c# .net

例如,要使用本地IP地址:

 string myHost = System.Net.Dns.GetHostName();
 string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString();

1 个答案:

答案 0 :(得分:3)

这是一个可能有用的链接。 http://www.dreamincode.net/forums/topic/24692-showing-the-external-ip-address-in-c%23/

关于向WhatIsMyIP.com进行网络请求有一个很好的帖子