外部IP地址
可能的重复:
检索外部的稳定方式NAT 后面的主机的 IP
好吧,你好。我想知道如何获取计算机的外部 IP 地址(外部,因为有些人有路由器)?
Possible Duplicate:
Stable way of retrieving the external IP for a host behind a NAT
Well, hello again. I was wondering how do i get the External IP Address (External since some people haves router) of the computer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编写一个程序并使用 HTTP 协议连接到一些外部网站,例如:
http://www.whatismyip.com/
然后写一个解析器解析出来:
您的 IP 地址是:xxx.xxx.xxx.xxx
瞧。
Write a program and use HTTP protocol to connect to some external websites such as this one:
http://www.whatismyip.com/
Then write a parser to parse out:
Your IP Address Is: xxx.xxx.xxx.xxx
Voila.
这是使用用户建议的一种方法...当然,这仅适用于您自己的 IP,您也可以通过打开命令提示符并运行 ipconfig /all 来确定
仅供参考:http://www.whatismyip.com/ 请求您仅每 5 分钟一次 所以我觉得有必要提出警告,不要更频繁地运行此代码:P
注意: http ://automation.whatismyip.com/n09230945.asp 是自动化文件的最新地址。 5 分/300 秒的规则仍然有效。
Here's one way of using user's suggestion ... of course this only works for your own ip which you could also determine by opening the command prompt and running
ipconfig /all
FYI: The owner's of http://www.whatismyip.com/ request that you only hit this automation page once every 5 minutes so I feel compelled to put a caveat not to run this code more often than that as well :P
Note: http://automation.whatismyip.com/n09230945.asp is the newest address for the automation file. the 5 minute / 300 second rule is still in place.