views:

39

answers:

1

Hi

Have a server-socket running in an android application, which I debug using the emulator. Using the emulators console and "redir add tcp:8888:8888" I can make the service available to a program running on my development machine (as localhost:8888).

The redir port is however not available on any other network interface, meaning I can't access it through the host-ip on either the local development machine, or from a secondary machine on the network. Anyone know if its possible to make the emulator bind to all network interfaces, or have some other trick to enable other hosts on the network to connect to the emulator?

Thanks

A: 

Technically, the emulator bounds socket on the local loopback. You can see it from the netstat command

$ netstat -an | more
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
...
tcp4       0      0  127.0.0.1.8888         *.*                    LISTEN
...

"Local Address" should be *.8888 in order for your service to be reachable from outside.

The only solution you have is to forward a port from the physical interface to the local loop.

On linux, which is the system I understand you are using, the easiest way to do it is by means of iptables using any source interface as input and 127.0.0.1 as destination address.

You will need administrator privileges but it can be done on a per-session basis.

Dario