简体   繁体   中英

How to get the process id in android if you know the tcp port the process using

If somebody know the TCP/UDP port, how to get the process id which is using the port in android. if there some common APIs or command lines can do this in all different android os. i don't want to modify the function of searching process id for different android os. Very Thanks!

You could install busybox to get commands such as lsof and fuser.

If you don't want to do that, perhaps scripting something to cat /proc/[pid] for each pid and grep for the port you are interested in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM