如何连接到在Android模拟器中运行的HTTP服务器? [英] How to connect to a http server running in android emulator?

查看:312
本文介绍了如何连接到在Android模拟器中运行的HTTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Android模拟器上有一个HTTP服务器正在侦听端口8080.如何从同一台PC的浏览器连接到它?我尝试了127.0.0.1,但无法连接.

I have a HTTP server working on my android emulator listening to port 8080. How can I connect to it from same PC's browser? I tried 127.0.0.1 but it couldn't connect.

推荐答案

您必须在adb中启用端口转发.例如:

You have to enable port forwarding in adb. For example:

adb forward tcp:8080 tcp:8080

这会将传入的连接转发到 localhost TCP/8080到仿真器TCP/8080.

This will forward incoming connections to localhost TCP/8080 to the emulator TCP/8080.

此处是参考.

这篇关于如何连接到在Android模拟器中运行的HTTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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