Linoleum

Friday, February 24. 2012

If you're writing Android network code and need test it with the Android emulator, you'll quickly run a problem: the emulator doesn't have a 'real' network interface, and cannot be reached from the outside world. Fortunately, there's a way to resolve this.

To forward a tcp port to the emulator, use:

adb forward tcp:sourceport tcp:destport

For example, to forward port 8000 on the host to port 8500 on the emulator, use:

adb forward tcp:8000 tcp:8500

To redirect a UDP port, telnet to the emulator's port (usually 5554) and then use redir: