There are two host devices Host-A, Host-B, running in Network-A and Network-B. Moreover, three processes are running on each end device. Each process of Host-A wants to send the data to some processes of Host-B.
...
Sending data from one process to another process is accomplished by the transport layer. In order to send data from one process to another, first we need to send the data to the destination host. In order to achieve this, we use the network layer as both of the processes are in different networks.
The transport layer adds its header, assigns each process a unique port number, and passes it to the network layer. Furthermore, the network layer uses the logical addresses of the source host and destination host. It routes the data to its destination host. This is the reason the network layer is known as the source-to-destination delivery layer. It’ll make a routing table for the shortest possible path from source to destination. Also, it switches the packets from different networking devices.
...