Network communication is very complicated. To simplify things we break down different parts of the communication into four layers.
A single protocol must only work at a single layer and each one manages a different part of communication and thus groups similar protocols together.
We call the layered system the TCP/IP Stack.
The Layers
- Layer 4 - Application: Called application because this is the level that user software works at. Protocols on this layer format the data to be sent correctly or unpackage the formatted data to be used when received
- Layer 3 - Transport: Breaks down the formatted data into packets. Numbers the packets so they can be put back in order. Checks all packets are sent and received. Identifies how the computer should deal with the data using Ports (port numbers identify which kind of application the data should be used by)
- Layer 2 - Internet: Manages making the connections between different Networks. Used by routers to pass data between networks.
- Layer 1 - Link: Manages how the data is sent over cables or wireless signals
How the TCP/IP Stack works
Benefits of using Layers
- Protocols in each layer are self contained and don’t need to consider what other layers are doing. If someone was to create a new online game which passes data between different players, they only have to worry about working with one layer.
- Protocols can be changed within a layer without re-writing the layers above and beneath it. We can swap HTTP with HTTPS in the application layer without re-writing how data is sent down a cable or how the data is broken apart into packets.