4.2 Communication between Hosts in Packet-Switched Networks

All communications on a network originate at a source, and are sent to a destination. The information sent on a network is referred to as data or data packets. Let host A be a source and let host B be a destination.
As shown in the Figure 5 real communication happens through physical medium while logical communication between host A and host B takes place on logical link between two peer layers. Hosts A and B communicate using peer to peer protocol of corresponding layer.

Communication between hosts
Figure 5: Communication between hosts

If host A wants to send data to host B, the data must first be packaged through a process called encapsulation. (Figure 6).
Encapsulation wraps data with the necessary protocol information before network transit. Therefore, as the data packet moves down through the layers of the OSI model, it receives headers, trailers, and other information.
Once the data is sent from the source, it travels through the application layer down through the other layers. The packaging and flow of the data that is exchanged goes through changes as the layers perform their services for end users.

Network must perform the following five conversion steps in order to encapsulate data:

  1. Build the data – As a user sends text file or an e-mail message, its alphanumeric characters are converted to data that can travel across the network.
  2. Package the data for end-to-end transport – The data is packaged for transport over the network. By using segments, the transport function ensures that the hosts at both ends of the network can reliably communicate.
  3. Add the network IP address to the header – The data is put into a packet or datagram that contains a packet header with source and destination logical (IP) addresses. These addresses help network devices send the packets across the network along the best path.
  4. Add the data link layer header and trailer – Each network device have to put the packet into a frame. The frame allows connection to the next directly-connected network device on the link. Each device in the chosen network path requires framing in order for it to connect to the next device.
  5. Convert to bits for transmission – The frame have to be converted into a pattern of ones and zeros (bits) for transmission on the physical medium. A clocking function enables the devices to distinguish these bits as they travel across the medium. The medium can vary along the path used. For example, web page can originate on a server, cross a campus backbone, and go out a WAN link until it reaches its destination on a remote LAN.
Encapsulation and Decapsulation
Figure 6: Encapsulation and Decapsulation

As shown in the Figure 6. host B performs inverse process called decapsulation. First on physical layer it decodes bits and then each layer cuts its header and sends the data packet to the upper layer. In the end we have original data sent by host A. Each pair of adjacent layers communicate through interface. The interface defines which operations and services the lower layer makes available to the upper one.

PDU (Protocol Data Unit) is information that is used by peer to peer protocol.
SDU (Service Data Unit) is information that is sent through interface of pair of adjacent layers. (Figure 7)

Data Unit and Header
Figure 7: Data Unit and Header
Circuit-Switching, Message-Switching and Packet-Switching Basic Definitions in Data Networks Bandwidth, Throughput and Delay