问题描述
我是 android 新手,想在 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 中)运行并桥接"连接.确保每个 VM 都有静态 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.
这篇关于Android 2 模拟器通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!