views:

138

answers:

1

Hi,

This is a query regarding the usage of adb on android.

Is there a way to forward the remote port i.e. port on the android device/emulator to the local machine to which the device is connected?

$ adb forward tcp:port1 tcp:port2 # forwards the local port port1 on the machine to port2 on the device.

Thanks in advance!

A: 

Do you truly need to forward the port or are you just looking for a way to communicate using sockets from a program running on the android shell to your host machine? I was able to accomplish the latter by sending my message to the port of interest on "10.0.2.2", which is the loopback adapter of the host machine. See docs here.

RickNotFred