how to connect two emulator instances on the same

2019-04-16 05:18发布

Here it goes.

There are two emulator instances say A and B on same machine that is connected to internet. Now I need to transfer a file between A and B. How do I do that ?

I writing a ftp might make sense .. but am not sure of how the ports and ips would be. are there any thing that Android supports for easy file transfer ? (Should work between emulators)

It would be great to know all the ways to do it.. Thanks

1条回答
爷的心禁止访问
2楼-- · 2019-04-16 06:03

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!

查看更多
登录 后发表回答