Home
Contents
TCP/IP Stack
TCP / UDP
Packets
SSH
DNS
CDN
📨 TCP/IP Stack
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>
📲 TCP / UDP
TCP
The Transmission Control Protocol (TCP) is a connection-oriented protocol for communications. It breaks down the data into small bundles and afterward reassembles the bundles into the original message on the opposite end.
Three-way handshake
The TCP model uses a three-way handshake to establish connection.
-
Sender sends a segment with a SYN (synchronize sequence number) which informs the recipient that the client is likely to start communication.
-
Recipient responds with SYN-ACK to the client request. Acknowledgement (ACK) signifies the response of the segment it received, and SYN signifies with what sequence number it is likely to start the segments with.
-
Finally, sender sends ACK in response to the recipient, and they both establish a reliable connection with which they will start the actual data transfer.

UDP
The User Datagram Protocol is an unreliable and connectionless protocol. Unlike TCP, UDP does not guarantee delivery, order, or error checking, making it a lightweight and efficient option for certain types of data transmission such as video conferencing.

- Used for simple request-response communication when the size of data is less and hence there is lesser concern about flow and error control.
- It is a suitable protocol for multicasting as UDP supports packet switching.
- Normally used for real-time applications which can not tolerate uneven delays between sections of a received message.