如何使用ADB Shell查找进程正在使用的端口?
问题描述:
例如,在Android中,进程1234的PID使用端口2222、2223、2224.现在我有一个PID1234.我想知道如何找出进程正在使用的端口号2222、2223、2224?
For example, in Android, the PID of a process 1234 is using ports 2222,2223,2224. Now I have a PID 1234. I was wondering how to find out port numbers 2222, 2223, 2224 which the process is using?
我曾尝试像在Linux中那样使用netstat -anp,但这没有用. ADB Shell中的netstat -anp与netstat具有相同的效果,后者没有任何命令参数.
I have tried using netstat -anp just as the way in Linux, but that didn't work. netstat -anp in ADB shell has the same effect as just netstat, which is without any command arguments.
答
您可以使用busybox netstat -pt
或cat /proc/1234/net/tcp