IP 地址和端口号可以一起唯一标识进程 ID 吗? [英] Can an IP address and a port number together uniquely identify a process ID?
本文介绍了IP 地址和端口号可以一起唯一标识进程 ID 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IP 地址和端口号能否一起唯一标识进程 ID?
Can an IP address and a port number together uniquely identify a process ID?
我正在寻找一种方法来获取相应的进程 ID,给定一个 IP 地址和一个端口号,但我不确定这样的 ip/端口对是否可以唯一标识一个 pid.
I'm looking for a way to get the corresponding process ID, given an IP address and a port number, but I'm not sure whether such ip/port pairs can uniquely identify one pid.
推荐答案
不一定.如果一个进程打开/接受了一个socket,然后fork,子进程也打开了这个socket,所以IP地址和端口号被两个进程使用.
Not necessarily. If a socket is opened/accepted in a process, and it then forks, the child process also has the socket open, so the IP address and port number are used by two processes.
这篇关于IP 地址和端口号可以一起唯一标识进程 ID 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文