2

I have a server running inside and android emulator listening in port 8080.

after the port forwarding i was able to connect to the server via my web browser "from the host(my real os)", but only if i put 127.0.0.1:8080, the problem is i can't connect if i put 192.168.1.12:8080 which is my LAN address.

some explication and how to fix it please.

other way to explain the problem: i'm in USA running a server inside my android emulator, i want some one from japan,canada...to be able to access and connect to it. or i want my second laptop to access to my server in first laptop which is the same network.

SRedouane
  • 498
  • 5
  • 10
  • 1
    make sure your device connect with LAN network..and if you are using emulator for connection then use `10.0.2.2:8080`. – Chirag Ghori Feb 22 '14 at 05:58
  • i use emulator not a device. and i tried to connect from same host "my real os" with different maner – SRedouane Feb 22 '14 at 06:01
  • Refer this [connect localhost android emulator in eclips](http://stackoverflow.com/questions/5806220/how-to-connect-to-my-http-localhost-web-server-from-android-emulator-in-eclips) – Chirag Ghori Feb 22 '14 at 06:01
  • @BlackTiger you did not understand my question, i will modifie it for better explanation. and the official doc does not cover this topic/ problematic – SRedouane Feb 22 '14 at 22:29
  • @BlackTiger if i use virtual-box as emulator, yes i can connect in both direction "to/from emulator to any server in any location in the world". but with adb i can't, it is limited to be used in single machine and i can connect to/from just localhost. – SRedouane Feb 25 '14 at 07:15

1 Answers1

1

resolved,

the thing is that adb accept connection only from 12.0.0.1 no thing else.

so i install android in virtual-Box and redirect connection from 192.162.2.101 "my lan ip address" to 10.0.2.10 "android ip address in the emulator"(i do that in the virtual-box network UI".

and every thing work well.

adb "google emulator" is designed to be used/access in single host.

SRedouane
  • 498
  • 5
  • 10