Before we start, I just want to let you know that Gacha Coders will be out tomorrow.
It's a Gacha game that teaches you Docker.
Stay tuned.
Sending data from one device to another is a complicated process.

OSI is a conceptual model that standardizes the process.
It consists of 7 layers.

Let's see how it works by going through a real-life scenario you're already familiar with.
Sending a Discord message to your friend.
Layer 7: Application
The first step is to open Discord.
You type the message and hit send.
This is layer 7. The application layer.

Layer 6: Presentation
A computer doesn't understand what a Discord message is.
That's why Discord will parse that data into a common format (like JSON).

This is the job of layer 6.
It's responsible for creating compatible and encrypted data to be sent.
Layer 5: Session
The data is ready.
It's time to establish a connection with another device.
Layer 5 maintains and manges that connectinon.
Layer 4: Transport
To send the data, you have two main options.
TCP and UDP.
TCP is slower but more reliable.
UDP is faster but less reliable.
Let's say you pick TCP.
First, the data is split into smaller chunks called segments.
In each segment, you add a TCP header with information like ports, sequence number, and ack number.

Segment = data (chunks) + L4 header
Each layer you move down you will add info to that data to help it get to its final destination.
Layer 3: Network
To send data, you need to know where the other device is located, right?
For that, we need the IP address of the other device.
In layer three, we add an IP address header to the data.
A segment becomes a packet.

IP address tells you where this data is going.
Layer 2: Data link
IP address alone isn't enough to locate the device.
Why?
Because IP addresses change, and they're not unique to any device.
We need something more specific called the MAC address, also known as the hardware address.
It's burned into the device and can be used to identify it.
So in layer 2, you add a MAC address header (of both sender and receiver) to the packet.

Layer 1: Physical
So far, the output is digital.
To actually send data, you need to do it through physical media.
Like radios or wires.
Layer 1 describes how to turn 0 and 1 into actual signals.

For wires: high voltage = 1. Low voltage = 0.
For fiber cable: Light on = 1. Light off = 0.
Encapsulation
The data goes all the way to Discord's server, then to your friend’s phone.
Once it reaches the destination, the reverse happens.
The signal goes from layer 1 up to layer 7 and becomes a message shown on the Discord app.
- Fee from Anime Coders
