gpt4 book ai didi

android - Android 模拟器之间的通信

转载 作者:太空狗 更新时间:2023-10-29 13:42:27 24 4
gpt4 key购买 nike

我想知道是否有可能在两台联网的不同机器上启动两个 Android 模拟器之间的通信。

例如- 模拟器 A 在机器 M1 上运行- 模拟器 B 在机器 M2 上运行

A 和 B 可以交换消息吗?

如果是,我使用什么 IP 地址?

非常感谢黛博拉

最佳答案

您可能已经知道这一点。从 android-sdk-tools_r7 开始,至少应该可以将两个模拟器相互连接。我不知道它是否在物理机器之间工作。可以为此特定广播在两个主机之间设置伪装。

来自安卓commit

Enable interconnection of emulators

This patch adds a -shared-net-id option to the emulator whichjoins the emulator in a shared network.If the option is given the emulator is started with an additionalnetwork interface bound to a multicast socket. This multicast socketemulates a network hub, interconnecting emulators.If the -shared-net-id option is not given, nothing changes.

要连接两个模拟器,请使用 -shared-net-id <number>启动模拟器时的命令行选项。然后他们将直接共享发送到 ip 10.1.2.<number> 或从 ip 读取的所有内容在模拟器上。

另一种方法是使用 adb 在模拟器之间启用端口转发,然后在联网机器上为这些端口设置伪装。

我不太确定这些解决方案中的任何一个是否符合您所要求的用例。如果没有,向原始问题添加更多详细信息可能会有所帮助。 :)

免责声明:我没有尝试过第一种方法,而第二种方法我只是用来确保模拟器可以绕过讨厌的公司防火墙和 HTTP 代理,以便我们可以测试 android 浏览器。不过这个原则应该是合理的。

更新:不,我玩了很多,没有找到很好的解决方案。我的 iptables 不够好,无法以这种方式设置适用于服务器端的有效隧道。

问候,
迈克尔

关于android - Android 模拟器之间的通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4044479/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com