我怎样才能从我的Andr​​oid设备访问我的本地主机? [英] How can I access my localhost from my Android device?

查看:133
本文介绍了我怎样才能从我的Andr​​oid设备访问我的本地主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够访问使用Android模拟器我的笔记本电脑的Web服务器,现在用 10.0.2.2:portno 效果很好。

Am able to access my laptop web server using the Android emulator, am using 10.0.2.2:portno works well.

但是,当我连接我的真正的Andr​​oid手机,该手机浏览器无法连接到我的笔记本电脑相同的Web服务器。将手机连接到使用USB电缆的笔记本电脑。如果我运行 ADB设备命令,我可以看到我的电话。

But when I connect my real Android phone, the phone browser cannot connect to the same web server on my laptop. The phone is connected to the laptop using a USB cable. If I run the adb devices command, I can see my phone.

我在想什么?

推荐答案

USB不为移动设备提供网络。如果它连接到您的无线网络,然后打你的笔记本电脑地址路由器提供。如果它连接到移动网络,然后先搞清楚你的​​路由器的外部IP地址,然后一些端口转发到10.0.2.2:portno最后你就可以看到该服务器从您的设备。

USB doesn't provide network to mobile device. If it's connected to your wifi, then hit your laptop address provided by the router. If it's connected to your mobile network, then first find out your router external IP address, then forward some port to that 10.0.2.2:portno and finally you'll be able to see that server from your device.

这篇关于我怎样才能从我的Andr​​oid设备访问我的本地主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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