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

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

问题描述

我可以在 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?

我已经尝试过了,但是模拟器仍然像谷歌搜索本地主机一样接受我的请求,或者更糟的是它说它在我的网络服务器正常运行时没有找到页面.

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 Emulator 连接到我的 http://localhost Web 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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