Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I have forwarded machine port to emulator using following command

adb forward tcp:1234 tcp:8080

I wanted to see currently what all ports are forwarded to avoid any conflicts. How to do that ?

share|improve this question
    
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 '13 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. –  Vihaan Verma Feb 19 '13 at 8:43

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.