The TCP/IP stack is a layered framework for organizing data transmitted through the networks.

Application
The first level of the stack handles high-level protocols that define how data should be formatted, processed, and transmitted. It is called the Application layer.
Protocols:
- HTTP/HTTPS (HyperText Transfer Protocol) – for web browsing.
- SMTP (Simple Mail Transfer Protocol) – for email.
- FTP (File Transfer Protocol) – for file transfers.
- DNS (Domain Name System) – for translating domain names to IP addresses.
Transport
The transport layer exchange data receipt acknowledgments and retransmit missing packets to ensure that packets arrive in order and without error.
Protocols:
- TCP (Transmission Control Protocol) – Provides reliable, connection-oriented communication. It ensures that data is received in the correct order and without errors.
- UDP (User Datagram Protocol) – Provides faster, connectionless communication without reliability checks, often used for streaming or real-time applications like video calls or online gaming.
Network
Protocols:
The network layer or internet layer, ****is responsible for logical addressing of IP addresses and routing packets from router to router.
Protocols:
- IP (Internet Protocol) — Defines addressing and routing of packets to their destination.
- ICMP (Internet Control Message Protocol) — Used for error messages and operational information, like when a service is unavailable or a route is unreachable.
- ARP (Address Resolution Protocol) — Translates IP addresses to MAC addresses on local networks.
Link
The link layer handles the physical transmission of data. It deals with how data is sent and received over the network hardware (e.g., Ethernet, Wi-Fi).
Protocols:
- Point-to-Point Protocol (PPP) — Used to establish a direct connection between two network nodes, typically over serial links like telephone lines.
- Ethernet — Defines wired network connections.
- Wi-Fi (IEEE 802.11) — Defines wireless network connections.
Encapsulation is the process of data going down the stack, from Application to Link Layer.
Decapsulation is the process of data going up the stack, from Link to Application Layer.
How the TCP/IP Stack Works
- Application Layer: An application (a web browser) generates data, such as an HTTP request.
- Transport Layer: The data is passed to the Transport Layer, which (using TCP, for instance) breaks it into packets, adds sequence numbers, and ensures reliability.
- Internet Layer: The packets are handed to the Internet Layer, which adds the source and destination IP addresses and routes them across networks.
- Link Layer: The data is sent over the physical network (wired or wireless) using the Link Layer, which adds MAC addresses and ensures that the data reaches the correct device on the local network.
<aside>
💡
Packets are smaller segments of the larger segment.
</aside>