哪个线程监听特定的 UDP 端口
Which thread listens to a specific UDP port
我运行:
# lsof | grep 10900
及其输出:
MyExecutab 103497 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103498 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103499 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103500 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103501 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103502 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103503 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
我正在尝试找出哪个线程正在从 UDP 端口 10900 读取数据。
似乎有 7 个线程从该端口读取,是真的吗?
我觉得实际上只有一个线程在读取,但 lsof 只是列出了所有子线程(在同一进程中)和父线程。
netstat -plun
说明只有父线程(PID)在监听那个端口:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 10.7.168.173:10900 0.0.0.0:* 103497/MyExecutable
我也检查了/proc/[pid]/fd
。因为只有103497是PID,其余都是TID,所以/proc/
只有103497没有其他的
那么真的有办法找出哪个线程侦听特定的 UDP 端口吗?
我在 CentOS 7(内核 3.10)上。
谢谢!
运行 strace -ffp <pid>
并查看哪些线程使用文件描述符 7.
我运行:
# lsof | grep 10900
及其输出:
MyExecutab 103497 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103498 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103499 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103500 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103501 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103502 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103503 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
我正在尝试找出哪个线程正在从 UDP 端口 10900 读取数据。
似乎有 7 个线程从该端口读取,是真的吗?
我觉得实际上只有一个线程在读取,但 lsof 只是列出了所有子线程(在同一进程中)和父线程。
netstat -plun
说明只有父线程(PID)在监听那个端口:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 10.7.168.173:10900 0.0.0.0:* 103497/MyExecutable
我也检查了/proc/[pid]/fd
。因为只有103497是PID,其余都是TID,所以/proc/
只有103497没有其他的
那么真的有办法找出哪个线程侦听特定的 UDP 端口吗?
我在 CentOS 7(内核 3.10)上。
谢谢!
运行 strace -ffp <pid>
并查看哪些线程使用文件描述符 7.