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?
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.
Sign up to join this communityI 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?
I think a new command has been added since the earlier answers:
adb forward --list
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.