🌐 The Journey of Data Through the Network
When you send data (like a message, file, or web request), it’s broken into chunks and wrapped with extra information at each layer of the network stack.
Each layer gives the data a new name:
| Layer (TCP/IP Model) | Name of Data Unit | What it Contains | Analogy |
|---|---|---|---|
| Application (HTTP, FTP, etc.) | Message | Raw data from the app (e.g., your email text or web request) | The letter you write |
| Transport (TCP/UDP) | Segment (TCP) / Datagram (UDP) | Message + source/destination port + reliability info (TCP adds sequencing, ACKs) | Putting the letter in an envelope with delivery instructions |
| Network (IP layer) | Packet | Segment/Datagram + source/destination IP addresses | Writing the sender and receiver’s postal addresses on the envelope |
| Data Link (Ethernet, Wi-Fi) | Frame | Packet + MAC addresses + error checking (CRC) | Handing the envelope to the post office with a local delivery label |
| Physical (Cables, Wi-Fi signals) | Bits | 1s and 0s (electrical/optical/radio signals) | The actual truck, airplane, or signal carrying the letter |
📝 Simple Definitions
- Frame → At the data link layer.
Contains MAC addresses + error detection (used inside a local network, like Ethernet or Wi-Fi). - Datagram → At the transport layer when using UDP.
A self-contained unit with source/destination ports, but no guarantee of delivery. - Segment → At the transport layer when using TCP.
Similar to a datagram, but includes sequence numbers, acknowledgements, and flow control (reliable delivery). - Packet → At the network layer.
Contains the transport-layer data (segment or datagram) wrapped in an IP header (with source and destination IP addresses).
🔎 Example: Sending a Web Page
- You type
www.example.cominto your browser. - HTTP request = message.
- Transport adds TCP header = segment.
- IP adds source & destination IPs = packet.
- Ethernet/Wi-Fi adds MAC addresses & error check = frame.
- Converted to bits and transmitted across the network.
✅ In short:
- Segment = transport (TCP, reliable).
- Datagram = transport (UDP, unreliable).
- Packet = network layer (IP addresses).
- Frame = data link layer (MAC addresses).
Here’s the encapsulation view:

- The Message is the core.
- It’s wrapped in a Segment/Datagram at the transport layer.
- That’s wrapped again into a Packet with IP info.
- Then wrapped in a Frame with MAC addresses.
- Finally turned into Bits to travel over the physical medium.

Here’s the decapsulation view:
- The receiver starts with raw Bits on the wire.
- Converts them into a Frame (checks MAC & errors).
- Extracts the Packet (reads IP addresses).
- Pulls out the Segment/Datagram (TCP/UDP ports, reliability info).
- Finally delivers the Message to the application.
⚡ In short: sender wraps → receiver unwraps.