Android的2模拟器通信模拟器、通信、Android

2023-09-04 07:02:49 作者:赚钱养家

我是新来的Andr​​oid,并希望2仿真器之间创建一个简单的游戏。

I am new to android and want to create a simple game between 2 emulators.

仿真器1可以发送一个字符串到仿真器2和模拟器2可以发送一个字符串返回到模拟器1。

Emulator 1 can send a string to emulator 2 and emulator 2 can send a string back to emulator 1.

请能有人告诉我如何去关于这个问题,我不知道。

Please can someone advise me on how to go about this as I have no idea.

感谢。

推荐答案

要运行2仿真器在同一时间,我会建议为虚拟会话(如在VMWare)和桥梁连接运行它们。请确保您有静态IP地址为每个虚拟机。

To run 2 emulators at the same time, I would recommend running them both as virtual sessions (like in VMWare) and "bridge" the connections. Make sure you have static IP addresses for each VM.

当你只是他们之间发送文字,我会坚持到HTTP在这个阶段只是为了让概念验证的工作。只是不要太早复杂的生活。 HTTP应该是最简单的共同点与支持WiFi或移动运营商工作了。

As you're simply sending text between them, I would stick to HTTP at this stage just to get the proof-of-concept working. Just don't complicate your life too early. Http should be the easiest common denominator to work with for Wifi or Mobile carriers for now.

如果你的抽象对象模型正确,则可以在以后通过覆盖类使用其他通信协议。网络组件应该是透明的应用程序

If you abstract the object model appropriately, you can later use other communication protocols by overriding the classes. The networking component should be transparent to the application.