how to connect two emulator instances on the same machine and transfer data(a file) between them?

折月煮酒 提交于 2019-12-03 21:48:23

How to communicate between two Android emulators is explained in http://developer.android.com/guide/developing/devices/emulator.html:

Interconnecting Emulator Instances

To allow one emulator instance to communicate with another, you must set up the necessary network redirections as illustrated below.

Assume that your environment is

  • A is you development machine
  • B is your first emulator instance, running on A
  • C is your second emulator instance, running on A too

and you want to run a server on B, to which C will connect, here is how you could set it up:

  1. Set up the server on B, listening to 10.0.2.15:
  2. On B's console, set up a redirection from A:localhost: to B:10.0.2.15:
  3. On C, have the client connect to 10.0.2.2:

For example, if you wanted to run an HTTP server, you can select as 80 and as 8080:

  • B listens on 10.0.2.15:80
  • On B's console, issue redir add tcp:8080:80
  • C connects to 10.0.2.2:8080

Hope it helps!

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