[Tiny-Tut] - Communicating between two emulators

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

[Tiny-Tut] - Communicating between two emulators

Postby plusminus » Wed Mar 05, 2008 9:06 am

[Tiny-Tut] - Communicating between two emulators
,
:warning: (could not get this to work :( ) :warning:


first of all, if you want to run a server/service within an emulated system, you must
setup a network redirection (either through "[font=Courier New]adb forward[/font]" or the console's "[font=Courier New]redir add[/font]" commands). consider the following console example:

Code: Select all
redir add tcp:5000:7000


this setups a TCP redirection from your host's [font=Courier New]localhost:5000[/font] to the emulated system's [font=Courier New]localhost:7000[/font]

you can then run a server in the emulated system on emulated [font=Courier New]localhost:7000[/font], and outside clients will be able to access it through host [font=Courier New]localhost:5000[/font]

now, if you start a second emulator and wants it to connect to the service running on the first one. All you need to do is use the [font=Courier New]10.0.2.2[/font] address, which serves as an alias to your host localhost, so connect the client to [font=Courier New]10.0.2.2:5000[/font] and you will be all set.

note: yes, it's more a documentation bug than anything else. the [font=Courier New]10.0.2.2[/font] alias is a feature inherited from QEMU, which isn't even largely documented.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby chengduman » Fri Mar 14, 2008 6:39 am

hi +-

how can i set the ip address for another emulator? is it possible to send a gtalk message from one emulator to another that has installed the same app (intent receiver will react on the same action as the sending emulator)

thanks!

yuan
chengduman
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 24, 2007 5:42 am
Location: montreal

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests