Communication Protocols: The Basics
The communication protocols are standardized by ISO in a scheme called the Open Systems Interconnection (OSI) model. The OSI model structures the communication protocols into seven layers as shown in the following table. In other words, there are various communication protocols which can be at any of the seven layers. For example, Ethernet is a communication protocol at the physical layer, TCP and UDP are communication protocols at the transport layer, and HTTP and HTTPS are communication protocols at the application layer.
Layer number | Layer name | Protocol data unit |
7 | Application layer | Data |
6 | Presentation layer | Data |
5 | Session layer | Data |
4 | Transport layer | Segment/Datagram |
3 | Network layer | Packet |
2 | Data link layer | Frame |
1 | Physical layer | Bit |
In a connection/network, two or more devices are connected. During a data transfer, one device serves as a sender while another device serves as receiver. The process of transferring the data between two or more devices is called communication. During a communication, the data goes through the seven layers. From the sender, the data goes through layer 7 to layer 1. To be received by a receiver, the data goes through layer 1 to layer 7.
The application layer serves as the interface with a user. Some examples of application-layer protocols are HTTP, HTTPS, FTP, SMTP, and POP3. The HTTP and HTTPS are used for web browsing. FTP is used for data transfer. SMTP and POP3 are used for emailing.
The presentation layers functions to translate to/from the application layer. From the application layer, the presentation layer translates the user input into binary format. The presentation layer can perform data compression to reduce the size of the data and hence the data can be transferred faster. Furthermore, the presentation layer can also perform encryption/decryption. From the application layer, i.e. the sender, the data is encrypted. At the other end, i.e. the receiver, the encrypted data will then be decrypted. In summary, the presentation layer performs three functions: translation, data compression, and encryption/decryption.
The session layer helps to set up and manage the connection/disconnection/reconnection. To establish a connection, the session layer can perform authentication, which basically asks a user “who you are” (in the form of username and password) to give access to the network. Once authentication is performed, the session layer can perform authorization to give permission to an authorized user to access some files/data. Finally, the session layer also performs session management. For example, it manages a download process. In summary, the session layer has three functions: session management, authentication, and authorization.
The transport session controls the reliability of communication through segmentation, flow control, and error control. In this layer, the data is divided into segments or datagrams. This is called segmentation. The transport layer also control the transfer rate to adapt with the capability of the receiver device to receive the data. Furthermore, the transport layer can also repeat transfer request if there is a missing or corrupted data through checksum. This is called the error control.
There are two main transport-layer protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). The TCP is connection-based protocol, meaning it will check if the data is received through acknowledgement using a three-way handshake mechanism. Hence, TCP ensures the reliability and integrity of the data transfer. On the other hand, UDP is connection-less protocol, meaning it does not care whether a sent data is received or not. The sender will keep sending the data as fast as possible without checking whether the data is really received by the receiver or not; the data delivery is not guaranteed. The data sequence/order is maintained in TCP, whereas it is not maintained in UDP. Hence, UDP transfers the data faster than TCP but lacks reliability and integrity. The header of a TCP data contains more information and hence is heavier, whereas the header of a UDP data contains less information and hence is lighter. Considering such characteristics, TCP is typically used in WWW, email, and FTP data transfer, whereas UDP is typically used in live streaming, video games, and VOIP. The data units in TCP and UDP are called segment and datagram, respectively.
The network layer functions are logical addressing, routing, and path determination. The logical addressing is performed through IP addressing, using either IPv4 or IPv6. Each computer in a network has a unique IP address. Again, please notice that IP, which is used for logical addressing, is residing at the network layer. The routing means delivering data to a correct IP address. The path determination means a way to determine the best path (among all possible paths) to send a data from a sender to a receiver. The data unit in the network layer is called data packet.
The data link layer is responsible for physical addressing. This is done through the use of 12 digit Media Access Control (MAC) address; and hence this is called the MAC layer. Each computer hardware has its own unique MAC address, provided by the hardware manufacturer. The data unit at the data link layer is called frame. At the data link layer, a data frame error check is also performed in the so-called logical link control (LLC).
Finally, the physical layer represents the communication physical media. It converts the data frames in the data layer to data bits, and subsequently from data bits to signals, or the other way around. The signals can be electrical signal in a cable media (such as Ethernet cable and serial cable), or light signal in an optical media (such as optical fiber), or radio signal in air media (such as Wifi and Bluetooth). Some examples of physical-layer protocols are Ethernet, RS232, RS485, USB, CAN, Wifi, Bluetooth, etc.