有没有一种简单的方法来安装Android模拟器来访问主机的局域网?

编程入门 行业动态 更新时间:2024-10-24 17:23:19
本文介绍了有没有一种简单的方法来安装Android模拟器来访问主机的局域网?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想访问来自Android模拟器提供的一台机器上我的局域网Web服务。

I would like to access a web service provided by one of the machines on my LAN from the android emulator.

如果该服务是在同一台机器上,其中模拟器运行(称为主机)上运行,我可以添加一个网络重定向和访问与正确的端口10.0.2.2(在仿真器主机环回接口)。

If the service was running on the same machine where the emulator is running (called host), I could add a network redirection and access the 10.0.2.2 (host loopback interface in the emulator) with the correct port.

但它在另一台计算机局域网上运行。我想我可以另外添加其他重定向主机上与上述的(本来虽然使用iptables打...),但更简单的解决办法存在?

However it is running on another machine on the LAN. I guess I could add another redirection on the host additionally to the above one (would have to fight with iptables though ... ), but does a more simple solution exist ?

推荐答案

嗯,很好用(TM)。

在我的测试之前读过Android模拟器说明书(我尝试做的事情之前,RTFM)这是说:

In the android emulator manual that I had read before testing (I try to RTFM before doing things) this is stated:

模拟器的每个实例运行背后的虚拟路由器/防火墙服务,从开发机器的网络接口和设置,并从互联网隔离开来。一个模拟装置不能在网络上看到您的开发机器或其他模拟器实例。相反,它只能看到,它是通过以太网连接到一个路由器/防火墙

Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings and from the internet. An emulated device can not see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall.

这让我觉得它不能访问我的局域网。我错了,只是增加我的局域网服务器的IP允许我从仿真器访问它。

This made me think that it could not access my LAN. I was wrong, just adding the IP of the server on my LAN allowed me to access it from the emulator.

更多推荐

有没有一种简单的方法来安装Android模拟器来访问主机的局域网?

本文发布于:2023-10-27 23:34:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534859.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模拟器   方法来   局域网   主机   简单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!