Chapter 9

OSI Model

By Nikhila Sattala
October 12, 2021

The moment you read OSI, I am sure a picture of 7 layers might have popped up in front of your eyes. And many of us might have by hearted the mapping tool like : Layer 3 is for networking, Layer 4 is for Transport, Layer 5 for Session without exactly knowing the real time working of this model.


So here in this section I will try to explain how knowledge on this model might help during developing a real time web application.

Just to keep in mind, while a foundational understanding of the OSI model is useful, deep knowledge of it may not be required for every specialization.

Reality is, modern software and hardware often abstract away many of the intricacies of network communication. Developers, for example, can often rely on high-level libraries and frameworks that handle networking details for them, reducing the need to understand the OSI model in-depth.

Many tasks related to network management and troubleshooting are automated through tools and scripts. While these tools may leverage OSI model concepts in the background, users may not need to delve into the details of the model to use them effectively.

So let us first briefly understand why the OSI model was created? How does it benefit the networking industry? Let's briefly explore its purpose and industry impact.
As you know, we use various software applications for communication and data exchange. These applications adhere to common protocols like HTTP, SMTP, or FTP.
These protocols are internally adhered to the OSI model. So the OSI model,
  • established a common language and set of rules for network communication, helping in the development and implementation of various networking protocols and technologies.
  • as all these technologies follow the same standards of OSI model, they can run on servers and devices from different vendors without compatibility issues.
Layer 7 - Application Layer:

  • The whole application logic that developers write (e.g., React, Python, JavaScript) falls under the application layer.
  • Web applications are accessed using HTTPS (Hypertext Transfer Protocol Secure), which is an application layer protocol.
  • This layer presents functionalities and services like HTTPS, allowing the software application to present data to users securely.
Layer 6 - Presentation Layer:

  • Critical data in databases is often encrypted to ensure security. This encryption is typically done by protocols like SSL/TLS (Secure Sockets Layer/Transport Layer Security), which operate at the presentation layer.
  • SSL/TLS ensures that data transmitted between the web application and the database is encrypted and secure.
Layer 5 - Session Layer:

  • The session layer manages and maintains communication sessions, including session establishment, maintenance, and termination.
  • In a web application, cookies are used to store session-related data. Cookies help the server recognize and maintain user sessions across multiple requests.
  • Cookies facilitate the session management functions handled by the session layer.
Layer 4 - Transport Layer:

  • The transport layer is responsible for end-to-end communication and data integrity.
  • TCP (Transmission Control Protocol) is commonly used for services that require reliable, connection-oriented communication in web applications. For example, it ensures that data sent from the server to the client is received accurately and in the correct order. Services like HTTP, HTTPS, and SMTP (Simple Mail Transfer Protocol) operate over TCP.
  • UDP (User Datagram Protocol) is used for services that prioritize speed and efficiency over reliability. In web applications, UDP may be employed for real-time video streaming, where small delays are acceptable, and occasional data loss is less critical.
Layer 3 - Network Layer:

  • The network layer is responsible for routing and forwarding data packets between different networks.
  • In a web application, the network layer handles the transmission of data packets between the user's device and the web server. It ensures that data packets are properly routed across the internet to reach the intended destination.
  • IP (Internet Protocol) is a key protocol at the network layer, managing addressing and routing.
Layer 2 - Data Link Layer:

  • The data link layer manages communication between devices on the same network.
  • In the context of a web application, this layer is typically managed by networking hardware and switches. It ensures that data is efficiently transmitted within the local network segment.
Layer 1 - Physical Layer:

  • The physical layer deals with the physical medium and hardware interfaces, such as cables and connectors.
  • In a web application, this layer encompasses the physical network infrastructure, including the physical cables, switches, routers, and network cards that connect the user's device to the web server.

We can understand better about User session management, Cookies, Data encryption etc for a web application in later sections of this course. No need to worry about them at this point of learning.