安卓网络地址
我的本地计算机上运行着一个 tomcat Web 服务器。我还有一台 HTC 愿望机和一台 Galaxy Tab。我的问题是,我无法从我的真实 Android 设备连接到我的本地计算机。当我尝试使用模拟器连接时,一切都很好。模拟器可与以下地址进行通信: 10.0.2.2,但真实设备没有
有人知道解决方案,或者为什么会出现问题?
I have a tomcat web server running on my local machine. I also have a HTC desire and a Galaxy Tab. my problem is, I cannot connect from my real android device to my local machine. When I try to connect using the emulator, everything's fine. Emulator works with communication to the address:
10.0.2.2, but the real devices don't
Does someone know the solution, or why there's the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须获取本地计算机的公开 IP 地址并连接到该地址。如果您位于路由器后面,则必须确保它允许数据包通过。
You have to get the exposed IP address of your local machine and connect to that. If you are behind a router, you will have to make sure that it allows the packets to pass.
您使用的是网络还是 WiFi?您应该使用 WiFi 并通过同一路由器连接才能访问 10.0.2.2。
还要确保本地计算机的传入端口(我假设为 80)已打开并且可以从外部访问。
Are you using network or WiFi? You should be on WiFi and connecting through the same router to have 10.0.2.2 accessible.
Also make sure you have your local machine's incoming port (I'm assuming 80) open and reachable from the outside.