hy again! I'm trying to connect two emulators running as server and client on the same PC.The thing is that one of them is inside a virtual machine.What addresses should I use for each of the emulators in order to connect between them? I'm using a TCP based connection! The first开发者_JAVA百科 emulator is running on Windows 7 The second one inside the Vmware is on Xp The IP of my PC inside the network is 192.168.71.1 Really gratefull if u answer.Thx!!
I imagine you'd want to use the localhost address (127.0.0.1). Set the server up to listen and once it is up and running have the client connect and you should be good to go. (Make sure the port you use matches, obviously.)
http://en.wikipedia.org/wiki/Localhost
A few more details would help:
- What is the IP address of the VM?
- Is it using NAT, bridged networking, or what?
- Do you really need to run the 2nd emulator inside a VM - this complicates networking.
UPDATE: Multiple emulators on 1 machine (no VM) You can launch another emulator from the command-line, using /emulator -avd . You'll need to create a second AVD for this to work. I use Linux, so can't give the exact details for Windows.
UPDATE: Communication between main machine and VM with android emulator I believe the emulator only listens on 127.0.0.1 for server sockets, so remote machines can't connect in - this is certainly the case for the debug sockets it uses. However, you can set up port forwarding using a similar method discussed in Remote debugging with Android emulator
It's good that you're using bridged networking, as NAT would stop the VM getting inbound connections, so the emulator would have no hope.
UPDATE #2: Port forwarding You can set up port forwarding between sockets on the local machine and on the emulator, using adb forward. It might also be worth looking at Communication between Android Emulators, there appears to be an undocumented emulator switch -shared-net-id that could help.
Hope this helps
Phil Lello
精彩评论