views:

159

answers:

2

I would like to access a web service provided by one of the machines on my LAN from the android emulator.

If the service was running on the same machine where the emulator is running (called host), I could add a network redirection and access the 10.0.2.2 (host loopback interface in the emulator) with the correct port.

However it is running on another machine on the LAN. I guess I could add another redirection on the host additionally to the above one (would have to fight with iptables though ... ), but does a more simple solution exist ?

A: 

You could get an actual android device and connect it to the LAN (i have done this).

How are you connecting to the host machine? through html? because if your app requires a hard line connection to the machine then its not a very good solution for a mobile device.

mtmurdock
if its html i dont see a problem.
mtmurdock
Yeah I have already tested this with my android device and it works. However it would be nice to be able to do it with the emulator as well.What do you mean by hard line ? It's not html, but a client commands interface on TCP, so quite similar.
Longfield
A: 

Well, it just works (TM).

In the android emulator manual that I had read before testing (I try to RTFM before doing things) this is stated:

Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings and from the internet. An emulated device can not see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall.

This made me think that it could not access my LAN. I was wrong, just adding the IP of the server on my LAN allowed me to access it from the emulator.

Longfield