Overview of OSI model & HTTP protocol

Arshad Suraj
7 min readMay 16, 2021
Photo by Christopher Burns on Unsplash

What is OSI Model?

OSI stands for “Open System Interconnection”. OSI is a reference model that describes how information from a software application in one computer moves through a physical medium to the software application in another computer.

OSI contains seven layers, Therefore, OSI model divides a whole task into seven sub tasks. Each layer is assigned a particular sub task. Each layer performs the task assigned to it independently.

What are the 7 layers of OSI Model?

Layers of OSI — picture by-geeksforgeeks

Physical Layer (Layer 1)

Physical layer is the lowest layer of OSI model. It is responsible for the actual physical connection among the devices. The physical layer transmits information in the form of 0s and 1s (bits). When receiving data, this layer will get the signal received and convert it into 0s and 1s (bits) and send them to the Data Link layer.

Physical Layer — Image by-Javapoint

Functions of the physical layer

  1. Bit synchronization
  2. Bit rate control
  3. Physical topologies
  4. Transmission mode

Data Link Layer (DLL) (Layer 2)

The data link layer is responsible error-free transfer of data frames over the physical layer. DLL can uniquely identify each device that resides on a local network. When a packet arrives in a network, DLL will transmit it to the Host using its MAC address.
Data Link Layer is divided into two sublayers,

  • Logical Link Control (LLC)
  • Media Access Control (MAC)
Data Link Layer — Image by-Javapoint

The functions done by Data Link layer are,

  1. Framing: The data link layer translates the physical’s raw bit stream into packets known as Frames. The Data link layer adds the header and trailer to the frame.
  2. Physical addressing: After creating frames, Data link layer adds physical addresses (MAC address) of sender and/or receiver in the header of each frame.
  3. Error control: Data link layer provides the mechanism of error control. If receiver detects any error, then it sends the acknowledgement to sender for the retransmission of the corrupted frames.
  4. Flow control: The data rate must be constant on both sides else the data may get corrupted thus , flow control coordinates that amount of data that can be sent before receiving acknowledgement.
  5. Access Control: When two or more devices are connected to the same communication channel, then the data link layer protocols are used to determine which device has control over the link at a given time.

Network Layer (Layer 3)

Network layer works for the transmission of data from one host to the other located in different networks. It also takes care of packet routing which means It determines the best path to move data from source to destination based on the network conditions, the priority of service, and other factors. The sender & receiver’s IP address are placed in the header by the network layer.

Note:

  • Routers are Layer 3 devices.
  • Network Layer use IP protocol (IPv4 and IPv6)
Network Layer — Image by-javapoint

The main functions of the Network layer are,

  1. Routing: The network layer protocols determine which route is suitable from source to destination.
  2. Logical Addressing: A Network layer adds the source and destination IP address to the header of the frame. Addressing is used to identify the device on the internet.

Transport Layer (Layer 4)

Layer 4 ensures that messages are sent in the order they are received and that data is not duplicated. The transport layer’s primary responsibility is to transfer the data completely. It gets data from the upper layer and converts it into segments, which are smaller units. This layer is known as an end-to-end layer because it establishes a reliable point-to-point connectivity between the source and the destination.

These are the two protocols that are used in this layer,

  1. TCP (Transmission Control Protocol)
  2. UDP (User Datagram Protocol)

UDP is an unreliable protocol, and when a data packet is received, the receiver does not acknowledge the sender. The sender also does not wait for a acknowledgement. But TCP is reliable protocol. Therefore, receiver acknowledges sender when he receives a data packet

Transport Layer — Image by-javapoint

Functions of Transport Layer,

  1. Service-point addressing: The transport layer adds the header that contains the process address known as a port address. Therefore, transport layer can identify which process a data packet belongs to.
  2. Segmentation and reassembly: Transport layer divides the message into multiple segments, and each segment is assigned with a sequence number that uniquely identifies each segment. When the message has arrived at the destination, then the transport layer reassembles the message based on their sequence numbers.
  3. Connection control: Provides both connection orientated and connection less service based on used protocol.
  4. Flow control
  5. Error control

Session Layer (Layer 5)

This layer is responsible for establishment of connection, maintenance of sessions, authentication and also ensures security.

Session Layer — Image by-javapoint

The functions of the session layer are,

  1. Session establishment, maintenance and termination: The layer allows the two processes to establish, use and terminate a connection.
  2. Synchronization: When transmitting data in a sequence, the session layer adds some checkpoints. If a data transmission error occurs in the middle of the process, the transmission will be reset from the checkpoint. This process is known as Synchronization and recovery.
  3. Dialog Controller: The session layer allows two systems to start communication with each other in half-duplex or full-duplex.

Presentation Layer (Layer 6)

Presentation layer is also called as Translation layer. The data from the application layer is collected and converted as a format that can be transmit over the network.

Presentation Layer — Image by-javapoint

The functions of the presentation layer are,

  1. Translation : For example, ASCII to EBCDIC.
  2. Encryption/ Decryption : The Encryption/Decryption is done here inorder to ensure security.
  3. Compression: Reduces the number of bits that need to be transmitted on the network.

Application Layer

The network applications use Application layer. These applications generate the data that must be sent over thenetwork. This layer also serves windows for application services to connect to the network and display the information they receive, to the user.

Application Layer — Image by-Javapoint

Common protocols that are used in the application layer are Hyper Text Transfer Protocol (HTTP), File Transfer Protocol (FTP), Post Office Protocol (POP), Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS).

Functions of Application layer,

  • File transfer, access, and management (FTAM)
  • Mail services
  • Directory services

HTTP Protocol

what is HTTP protocol?

The Hypertext Transfer Protocol is an application protocol for distributed, collaborative, hypermedia information systems that allows users to communicate data on the World Wide Web.

How does HTTP work?

HTTP clients (internet browsers) use TCP/IP or UDP networking protocol (combination of transport layer and network layer protocols) with HTTP to provide us the greatness and usefulness of WWW.

HTTP simply specifies rules for communication between a server and a client, but we must first connect to another computer in order to communicate. TCP/IP and UDP are two popular networking protocols used to connect computers together, so they can communicate.

How HTTP works — Image by-dev.to

Let’s understand this by an example.

Imagine we use internet browser to request www.google.com

  1. Browser uses TCP/IP protocol, provided by the Operating System, to connect to www.google.com server
  2. Browser sends HTTP request to the server using connection made in previous step
  3. Server receives HTTP request
  4. Server interpret HTTP request and respond with HTTP response
  5. Browser receives HTTP response
  6. Browser interpret HTTP response (e.g. if it’s HTML; render it)

Keep Learning ❤️

--

--