如何从Android模拟器连接到我的http://localhost网络服务器 [英] How to connect to my http://localhost web server from Android Emulator

查看:627
本文介绍了如何从Android模拟器连接到我的http://localhost网络服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android模拟器中如何将其连接到位于http://localhosthttp://127.0.0.1的本地主机Web服务器页面上?

What can I do in the Android emulator to connect it to my localhost web server page at http://localhost or http://127.0.0.1?

我已经尝试过了,但是仿真器仍然像Google搜索localhost那样接受我的请求,或者更糟糕的是,它说在我的Web服务器正常运行时找不到页面.

I've tried it, but the emulator still takes my request like a Google search for localhost or worse it says that it didn't found the page while my web server is normally running.

推荐答案

本地主机是指在其上运行代码的设备,在本例中为仿真器.

The localhost refers to the device on which the code is running, in this case the emulator.

如果要引用运行Android模拟器的计算机,请改用IP地址 10.0.2.2 .

If you want to refer to the computer which is running the Android simulator, use the IP address 10.0.2.2 instead.

您可以从此处了解更多信息.

You can read more from here.

这篇关于如何从Android模拟器连接到我的http://localhost网络服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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