Search code examples
androidwebsocketandroid-emulator

How to ping android emulator from host machine?


I have Anroid app with websocket server builin.
If I use app on physic device (that has IP-address in my local network), I can ping my device and send websocket packages.
But I faced with problem when I use emulator.
I know I can ping my host machine from emulator (via 'localhost'), and it works
On hostmachine ipconfig (on Windows) or ifconfig (Unix-based OS) show me something like that:

  1. 192.168.0.2
  2. 192.168.13.1 (for VMware Network Adapter)
    ...
    and no one address for 10.0.0.* address

What I must do to send websocket to emulator?

Got information about interfaces in emulator in hostmachine


Solution

  • @teapot418, thank you for help https://developer.android.com/studio/run/emulator-networking To communicate with an emulator instance behind its virtual router, set up network redirection on the virtual router. Use "telnelt localhost 5554" And use command like this: "redir add (tcp|udp):host-port:guest-port"