简体   繁体   中英

How to know external ip adress of the current pc

For example to get local ip address I use:

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

here's a link that may help. http://www.dreamincode.net/forums/topic/24692-showing-the-external-ip-address-in-c%23/

There's a good post on doing a webrequest to WhatIsMyIP.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM