In the ever-evolving landscape of web development, many professionals tend to focus extensively on high-level programming languages and frameworks, often overlooking the crucial networking fundamentals that underlie the functioning of the internet. However, delving into the intricacies of the TCP/IP stack can empower web developers with a deeper understanding.
TCP / IP model is not a physical thing.
Instead, it is a conceptual model used to understand how communications are made over the internet, and consists of 4 layers.
The application layer is the layer that interacts directly with the end user, providing the services and applications that allow users to access and use the network resources.
They are software applications you use on your computer, such as web browsers, email clients and messaging apps.
These use protocols such as:
The transport layer provides data transport services to and from the application layer. It offers two main options for data transportation: reliable and efficient or unreliable and fast.
This layer uses protocols like TCP to provide reliable communication between two devices and UDP to provide fast but unreliable transmission. (More on these in my other articles)
The transport layer takes the application data (for eg an HTTP POST request) from the application layer and packages it into segments, which are then sent over the internet using port numbers.
This layer is responsible for routing the data across multiple networks and it uses protocols such as the IP protocol.
It takes the data from the transport layer and packages it into packets, which are then sent over the Internet using IP addresses.
Think of it like a postal service that can deliver letters across the globe.
It needs to know the destination and the best route to get there. The Internet layer uses IP addresses to identify different networks and determines the best path for data to travel across them.
The network layer is considered an unreliable protocol as it does not guarantee the delivery of packets or their order. The reliability of communication is achieved by higher protocols, such as TCP which use IP as their underlying transport mechanism.
The link layer is responsible for taking the raw bits of data from the physical layer, and organizing them into frames, then moving data between devices that are physically connected.
Think of it like a postman that is delivering letters within the same neighborhood. The postman needs to know the addresses of the sender and the recipient, and also needs to make sure that the letters are properly packaged and labeled.
In the same way, the data link layer uses frames to package data and add information such as source and destination MAC addresses to ensure it gets delivered to the correct device.
Here is the animated version for those of you who prefer interactive videos: