Monday, 2 July 2012

Android Emulator Networking

Android Networking Issues :

connect form host to emulator , connect from emulator to host machine , ping host from emulator , ping emulator from host , server running in emulator and connect from through host, server running in host machine and connect from emulator

One of the simplest (but time eater) scenario I have faced is networking between your Android emulator and your Host machine.
Two problems I have faced are :

1) Connect Emulator to a Server running in host machine
2) Connect Host Machine to Server running in emulator

Out of these two, second one became real headache for me. But atlast solution I found was so simple.


Solution 1  : Connect emulator to server running in host machine :

For emullator , IP address of host machine is

So you can use this IP to connect to your host machine, for example:

Let us assume a web application ""sample" is running at port 8084 in your host machine.


and press enter, it will print your desired output.


Solution 2:

Connect Host machine to server running in emulator :

By default emulator IP is , but problem you will be facing is you can not connect using this IP and even
you can not ping this IP.

So solution I found was port redirection, very simple to do :

Assume one instance of emulator is running


i) open command prompt
ii) type " telnet localhost 5554 "  ans press enter  
iii)type " redir add tcp:fromPort:whichPort " and press enter

Step 3 here redirect your request, mean any request you will make using localhost:fromPort will deliver to emulator:toPort

iv) you can del redirection using command :

redir del tcp:fromPort

v) If you are working with udp, then use udp instead of tcp in command


  1. i am unable to open tomcat main page running on host machine from emulator. any ideas what could be the problem?

    1. Did you try

      Replace 8080 with your port number and don't use any if it is 80