UDP port forwarding for android emulator; "adb forward udp:port udp:port" and telnet localhost adb_port not working

adb, android, android-emulator, telnet

Solution

The typical telnet port for the first emulator is 5554.

Try:

telnet localhost 5554

Then you'll need to authenticate, the instructions are printed in the console. It should be something like copy the value from $HOME/.emulator_console_auth_token without the trailing '%'.

auth <auth_token>
redir add udp:36963:36963

Problem

Hi I am developing an app using android emulator. I need to register a UDP socket at some port X that can be accessible from local network. Since Android emulator is NAT'd so I need port forwarding. I followed this post "Reaching a network device by IP and port using the Android emulator". It shows that I need to use ``` adb forward tcp:localPort tcp:emulatorPort ``` but this scheme doesn't work for udp (If anyone knows its version for UDP then please let me know). For UDP I found another solution that I need to telnet to adb port as follows (My adb is running at port 5037) ``` telnet localhost 5037 ``` and redirect UDP port using redir command ``` redir add udp:36963:36963 ``` But when I telnet it gives the following error ``` telnet 127.0.0.1 5037 Connecting to 127.0.0.1:5037... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Connection closed by foreign host. ``` I tried a lot to find any solution for this but fruitless. I need to know any solution for accessing emulator from outer network.

Original source