When doing IPC using TCP/IP sockets using the loopback address, do common networking stacks skip framing the message in lower-level PDUs?

后端 未结 3 865
迷失自我
迷失自我 2021-02-04 07:33

In some environments such as Java, it\'s natural to use TCP/IP sockets to pass messages between processes on the same host using the \'localhost\' address (127.0.0.1 in IPv4, or

3条回答
  •  生来不讨喜
    2021-02-04 08:10

    Yes. When a packet/data to a Loopback address(127.x.x.x) is received, the IP layer of the TCP/IP uses the Loopback route to route the packet to itself.

    Looback Route

    Network Destination || Netmask || Gateway || Interface || Metric

    127.0.0.0 |||||||||||||||||||||| 255.0.0.0 || 127.0.0.1|| 127.0.0.1 || 1

    After routing it to itsef, at TCP/UDP layer with the help of protocol control blocks(per connection data structure) the corresponding socket and its owner process will be identified to deliver the packet/data.

    Bottom line, All the tasks at Data Link layers and Physical layers(of OSI Model) will be avoided.

提交回复
热议问题