communication between Android devices from different computer

白昼怎懂夜的黑 提交于 2019-12-12 18:28:05

问题


Is it possible t make two android emulator on eclipse communicate from two differents machines which are connected with a fast ethernet link ?

Thanks for reply


回答1:


Yes. The outgoing side just works, but the incoming side (whichever one is receiving the connection) is a bit more complicated. You would set up an emulator or adb port forward, but that only makes a port on the loopback interface ("localhost" ie 127.0.0.1) of the machine hosting that emulator ring through to the the emulator android device it is hosting. It probably will not accept connections on the external network. So to get around that, you can ssh from one hosting machine into the other, and set up an ssh port forward so a port on the loopback of the connecting machine forwards to a port on the loopback of the receiving machine and then forwards into its emulator...




回答2:


First, android emulators are independent of Eclipse. That is, you don't need Eclipse to run the emulators:

C:\android-sdk-windows\tools\emulator.exe -avd <AVD name>

So the answer to your question applies to both scenarios: emulator running from Eclipse or running without Eclipse at all.

As for your question: Yes, it is possible. The android emulator is a basically a heavily customized linux box.

From the command line, type: adb shell and you will find yourself in a familiar linux shell. :)

Then ping the IP address of the other emulator and see how communication flows.



来源:https://stackoverflow.com/questions/5864291/communication-between-android-devices-from-different-computer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!