Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果将 TCP 数据包发送到“localhost”或本地机器 IP 上的套接字,它将经过什么路径?会涉及到网络适配器吗?还是仅将数据从内存中的一个地址复制到另一个地址?
数据只复制到内存中(实际上,我的猜测是从用户空间复制到内核空间,然后在接收端点上复制回用户空间),不会涉及网络适配器。UNIX 通常包含一个用于此目的的虚拟“环回”网络适配器;即使您访问物理适配器上的本地地址,您也经常可以看到它在环回适配器上“移动”。