10

I have forwarded a machine port to an emulator using

adb forward tcp:1234 tcp:8080

I want to see which ports are currently being forwarded to avoid any conflicts. How do I do that?

2
  • can we do the reverse process in the same way ? I mean forwarding emulator port to host port ? can you have a look at my post stackoverflow.com/questions/14950748/adb-forward-does-not-work
    – Siva Kumar
    Feb 19, 2013 at 6:51
  • you can ping the machine port directly from the emulator by specifying the machine port. For example if you open up the browser in the android emulator and type the default machine address 10.0.2.2:portNumber you will send data to machine's port. Its been a long time since I last did it , check the ip it might be different. Just look up the docs. Feb 19, 2013 at 8:43

2 Answers 2

14

I think a new command has been added since the earlier answers:

adb forward --list
1

Do you mean you want to see which ports are being used on the PC or Android device? You can use the netstat command for this.

On Windows: netstat -an | find /i "listening"

On Linux: `netstat -an | grep "LISTEN " (notice the space after LISTEN)

This shows all the ports that are listening for incoming connection (i.e. have a server of some kind behind them). If you need to know which server, you can use this on Linux: netstat -anp | grep "LISTEN ". Don't know about the Windows counterpart, but there's a -o switch to print the process ID and you can compare it to the ones in task manager.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .