connecting emulators
I'm trying to create an application in adroid that connects to emulators both of them running on the same machine.And after asking a few questions in here and reading http://developer.android.com/guide/developing/devices/emulator.html#emulatornetworking I have a slightly idea of how to do it,at least that's how I fell,but still need some extra explanations.
How is on dev's guide
A is the machine
B the first emulator working as a server
C the second emulator which is considered the client开发者_运维问答
Each emulator works behind a virtual router and has the address 10.0.2.15.Now,none of this emulators see each other or the servicies on the host machine.
So,in order for the client to break and get to A it has to use the loopack address.By connecting to 10.0.2.2 at the port 5554(where 5554 is the port assignated to the emulator and is next to its name,like avd 5554).
Now,my power of understanding stops here,because I dn't get why should I put the server B listening on 10.0.2.15 to 5555(I get 5555 the port of the second emulator,the way I got them when I ran the second avd).... Please could someone light me,cause I've turned this site upside down and still can't figure.
And one last thing:What is the trick with redirecting from A to B?What's it purpouse? I really wanna understand this, so please give a understandable explanation:)
P.S:Hope I've done well editing my old comment and no one will get mad!
精彩评论