I can connect to apache server from chrome and firefox by typing 127.0.1.1:8080
and default page is shown, but when i type the same from my android emulator, no webpage is loaded, request timeout error, also if I try to connect via typing localhost
this page is shown:
problem loading page
Firefox can't establish a connection to the server at localhost
What is wrong with my localhost?
I also tried 10.0.2.2
from android emulator, still can't connect.
What is wrong here? Is my localhost switched? How to fix it? Please help
Thanks
Best Answer
You can't see it because it is another localhost. To determine valid host's IP just ping your host's name from Android Emulator.
It should return you address like
192.168.X.Y
or10.0.X.Y
. This is the correct address on which you should go with your browser.Also,
ifconfig
should show you the external (as it seems to AE) IP of your machine:So, in my case, specifying
10.0.0.125:8080
in the AE should return the right page. Theifconfig
command is also available in Android. Execute it to see the broadcast address of internal LAN.And if you still can't determine your IP, execute this inside AE:
It will return all available addresses. You should choose the one appropriate.