If you’re creating software that needs to communicate with a network — internal to your company or global across the Internet — it’s helpful for you to understand exactly how network communication works during every step of the process of transmitting data.
Many developers use the TCP/IP model to guide their knowledge on this subject, but there is another network communication model you should know about: the OSI Model.
But before we dive too deeply into the OSI Model, here’s a comparison that shows how the two network models differ from each other:
OSI Model vs. TCP/IP Model
|4||Application Layer||Transport Layer|
|3||Transport Layer||Network Layer|
|2||Internet Layer||Data Link Layer|
|1||Network Access Layer||Physical Layer|
OSI Model: Overview
Introduced in 1984, the OSI Model—standing for Open Systems Interconnection—was designed to show how networks communicate with each other. Though the modern Internet is not based on this model, many major companies adopted this standard when ISO announced it officially in 1984.
If you’re not familiar with the OSI Model in networking, don’t worry. We’re going to break down what it is in layman’s terms, and you’ll walk away understanding a lot more about computer networks once you’re finished reading this article.
Even if you’re not an expert on computers, having this foundational knowledge will well prepare you if you simply want to understand how it all works.
Layer 7 — The Application Layer
We start at the last layer because this is where the use of the model begins. Throughout this article, we’ll use an example of a basic software program created for a fictitious business-to-business (B2B) e-commerce company that sells T-shirts to other wholesale companies, which in turn sell those T-shirts to their retail customers in a brick-and-mortar location.
So, where does the communication begin? It begins here in the application layer, which is where an employee at Company A (the retail company) places an order with Company B (the wholesale T-shirt company) because they’re running low on inventory.
The order begins on a website Company B gives Company A access to after they are approved for a wholesale account. The employee puts all the items in their cart they need to order, and they hit “send” to finalize the order.
That “send” button is attached to a network protocol called HTTP—hypertext transfer protocol—which is the network protocol you use to communicate with web servers when you want to access a website.
No matter what the use case, all software that communicates over a network needs a protocol that sends or retrieves information from another computer that operates as a network server.
Layer 6 — The Presentation Layer
This next layer decides how this order needs to be encoded, encrypted, and/or compressed so the next layer can interpret the data being sent to it. These three operations do different things, so let’s look at what each means separately so you can understand what’s being done in the presentation layer.
When data is encoded, it simply means that it’s being translated in a way that the receiving computer understands it. So, when this order is encoded, it’s sent over to Company B’s web server with certain details their server understands.
For instance, their web server expects to see what items need to be ordered, how many, colors, sizes, etc.
When data is encrypted, it’s changed in a way that protects sensitive data from being accessed by anyone who’s unauthorized to view the data. In this example, one thing that’s important to encrypt would be Company A’s payment information.
The presentation layer will have modules that tell the sending computer how to encrypt this data, and the receiving computer will have a key that translates the encrypted data so the order can be processed successfully.
To make the network run as seamlessly as possible, data is also compressed before it’s sent. Put simply, compressed data is data that’s been reduced in size to ensure resources are accessed easily and data’s being sent in the smallest possible format.
In our e-commerce example, there might not be a heavy need to compress data if large files aren’t transmitted. However, the capability is there should they need to upload large image files if they’re requesting a custom T-shirt be made from their graphics.
Layer 5 — The Session Layer
This next layer will open up a line of communication for both computers to talk to each other. The session layer has a big responsibility to keep this session open as long as data is being transferred from one computer to the other.
So, in our example, Company B’s server will be open to receiving information as long as the order is still transmitted.
Through setting checkpoints, the session layer ensures they receive the entire order before they close the line of communication. If these checkpoints do not pass, the receiving server will tell the session layer to go back to the last successful checkpoint and resend the rest of the data. This checkpoint process ensures there are no interruptions or erroneous data getting sent to Company B’s server.
However, if the session fails, Company A’s employee will receive an error message, which will prompt them to resend the order because it wasn’t successful. Company B’s server will also have a log of the error should they need to do any troubleshooting to investigate the issue if it happens repeatedly.
Layer 4 — The Transport Layer
This next layer takes the order Company A sends and breaks it into segments called packets to make it easier to send across the network.
This layer enforces error control to ensure the order is received in full at Company B’s server. If it is not, Company B’s server will ask the sending computer to resend the data so it receives all the packets it needs to fulfill the order.
Once the error control passes, it can reassemble the packets in a way that makes sense to Company B’s server. This error control uses what’s called a checksum to signal to the receiving computer that the data hasn’t been corrupted.
It uses a hash algorithm that turns the data sent into a string of numbers and letters that are always of the same length. This works in the same way software applications turn passwords into hashes in a database. So, this sensitive data can’t be known by anyone other than the user who created it.
If the checksums don’t match, this signals to the server that the data has been changed in some way, and the communication will fail. The server will request for the packets to be resent, and it will do this until the hash codes match each other.
Layer 3 — The Network Layer
The network layer works in conjunction with the transport layer to ensure the data is transmitted successfully to the server.
It does this first by breaking up the packets into segments that get transmitted over the server. Then it also ensures these packets get reassembled when they’re finished transmitting.
However, the network layer also has another important job to carry out—it finds the best route from Company A to Company B, using network addresses known as IP addresses.
Each computer on the Internet, for example, has a unique IP address. This is similar to the address on your home because no other address in the world can have this address.
Through analyzing the origin and destination addresses, the network layer finds the best possible route to transmit all this information. It will find the route with the least obstructions that allows it to send the information the fastest way possible.
Layer 2 — The Data Link Layer
The data link layer is also involved in network communications in a way similar to the network layer. However, this layer, in particular, deals with two computers on a network that are physically connected to each other.
In our example of communication between Company A and Company B, the sending computer is not physically connected to the destination. So, the data link layer wouldn’t be involved in communication between those two nodes.
However, let’s say after the transmission of the order has been processed, the web server that received the order needs to send the information to the warehouse. Since they are on the same campus as the web server, it is likely they would be physically connected to each other through Company B’s internal network.
When that order gets transmitted to the warehouse for processing, the data link layer sends the message in frames by breaking packets down further. This all happens seamlessly because of two aspects of the data link layer: Logical Link Control (LLC) and Media Access Control (MAC).
The LLC component will first identify the network protocols used to transmit the message so the same protocol is used throughout the transmission. Then it performs error checking and pieces the frames and packets back together.
If you’ve dealt with computer hardware before, you’ve likely already heard the term MAC. In addition to an IP address, your computer also has a MAC address, which physically identifies your specific computer on your physical network.
The data link layer uses these addresses to connect devices and define permissions of what machines can access the data being sent across the physical network.
Layer 1 — The Physical Layer
Lastly, we have the physical layer in the OSI network model. And, as the name suggests, this layer deals with the physical components of the network:
- Physical cables
- Wireless cards and technology
This is the computer hardware on both the origin and the destination responsible for transferring the raw data from one computer to another.
So, components on Company A’s physical layer might be the wireless card on the employee’s computer that connects them to the Internet, along with any routers or firewalls that direct their outgoing traffic.
And, on Company B’s network, this would consist of their physical connection to the Internet, as well as any other hardware that allows them to communicate back to Company A.
The data transmitted on this layer is translated into binary code—the 1s and 0s that computers understand—so the server’s CPU understands what it needs to do. This is at the foundation of any computer that needs to carry out some action because it is the only language the computer understands.
Understanding the OSI model, its seven layers, and the interactions between these layers is crucial for any developer, network engineer, or enthusiast aiming to grasp the intricacies of network communication.
While the modern internet might not entirely adhere to this model, the principles and structure of the OSI model remain valuable. Though there are newer models, knowing this one makes for a nice foundation of knowledge for designing, understanding, and troubleshooting network systems.
In our journey through an e-commerce transaction, we explored each layer’s unique role in ensuring successful, secure, and efficient communication between different network entities.
From the application layer, where the interaction begins, to the physical layer, where the data is translated into binary code, the OSI model provides a comprehensive framework for understanding the complexity of data transmission.
|7||Application Layer||Handles network communication protocols, such as HTTP|
|6||Presentation Layer||Encodes, encrypts, and compresses data for transmission|
|5||Session Layer||Opens and maintains communication sessions between computers|
|4||Transport Layer||Breaks data into packets, enforces error control, and reassembles packets|
|3||Network Layer||Routes data between computers using IP addresses|
|2||Data Link Layer||Handles communication between physically connected computers using MAC addresses|
|1||Physical Layer||Deals with the physical components of the network, such as hardware and binary code|
The image featured at the top of this post is ©iStock.com/Igor Kutyaev.