获取物理IP地址背后的技巧是什么? [英] Whats the trick behind getting the physical IP address?

查看:179
本文介绍了获取物理IP地址背后的技巧是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用C ++和winsock库访问http://www.whatsmyip.org/时,如何获得相同的IP地址?

How can I get the same IP Address I get when I go to "http://www.whatsmyip.org/" using C++ and winsock library?

我知道如何获得127.0.0.1和路由器IP192.168.1.103...
但是当我得到http://www.whatsmyip.org/我得到65.55.105.132

I know how to get the "127.0.0.1" and the router IP "192.168.1.103"... But when I got to "http://www.whatsmyip.org/" I get "65.55.105.132"...

我如何做到这一点?

推荐答案

在一般的方式 - 你不能。您可以打开到whatmyip的http连接并解析结果。或者按照Justin在评论中的建议,使用 http://www.whatismyip.com/automation/n09230945.asp 并节省解析和带宽。但最终,这只会给你的IP / NAT /代理/任何你和whatsmyip之间的。该地址仅通过转发连接到您的计算机。

In a general way - you can't. You could open an http connection to whatmyip and parse the result. Or as Justin suggests in the comments, use http://www.whatismyip.com/automation/n09230945.asp and save on parsing and bandwidth. But in the end, that's only going to give you the IP of the NAT / proxy / whatever that's between you and whatsmyip. That address is only connected to your computer through forwarding.

没有一个一般的方法来检索您的路由器的面向互联网的IP地址(这是您看到的65.55.105.132 IP)。即使你可以,没有理由不能有更多层的NATing阻碍。

There isn't a general way to retrieve your router's internet facing IP address (that's the 65.55.105.132 IP you are seeing.) Even if you could, there's no reason that there couldn't be more layers of NATing getting in the way.

这篇关于获取物理IP地址背后的技巧是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆