TCP vs UDP Explained: Packet Transmission, Headers, and Packet Sniffing in Computer Networks

📌 Data Transmission Basics

Whenever we send data over a network using TCP or UDP, the data is divided into small units called packets.

These packets travel across the network separately and are later combined again at the receiver’s side.

This packet-based communication makes internet communication fast and efficient.

Infographic explaining TCP vs UDP protocols, packet transmission process, packet headers, TCP three-way handshake, and packet sniffing in computer networks.
Visual explanation of TCP vs UDP protocols, how data packets travel across networks, and how packet sniffing works in cybersecurity.

📦 Example: How Packets Work

Imagine Person 1 sends a video to Person 2.

The system will:

1.      Break the video into many small packets.

2.      Assign a number to each packet.

3.      Send packets through the network.

4.      The receiver rearranges packets in correct order.

5.      The original video becomes playable again.

Example received order:

3, 4, 5, 2, 1

Rearranged as:

1, 2, 3, 4, 5

🔹 UDP (User Datagram Protocol)

In UDP, packets are sent without establishing a connection.

Faster transmission
No confirmation required
Packets may arrive out of order or be lost

Example uses:

·         Video streaming

·         Online gaming

·         Voice calls (VoIP)

·         Video chats (Skype, IMO)

UDP focuses on speed over reliability.


🔹 TCP (Transmission Control Protocol)

In TCP, a connection must be established before data transfer.

Process:

1.      Sender sends Packet 1.

2.      Receiver confirms receipt.

3.      Sender sends Packet 2.

4.      Process continues sequentially.

Reliable communication
Ordered delivery
Error checking

Used by:

·         Websites (Google, Facebook)

·         Email services

·         File downloads

TCP focuses on accuracy and reliability.


🕵️ What is Packet Sniffing?

Packet sniffing means capturing and analyzing network data packets.

Programs used:

·         Wireshark

·         Kali Linux sniffing tools

A sniffer monitors network traffic and collects packets passing through the network.

⚠️ Educational Example

If two users are connected to the same Wi-Fi network:

·         A sniffer can capture packets moving across the network.

·         If a website uses HTTP (not HTTPS), data may travel as plaintext.

·         Login credentials could potentially be visible.

👉 Modern websites use HTTPS encryption, which protects data from sniffing attacks.

Important: Packet sniffing should only be used for learning, security testing, or authorized network analysis.


📑 What is a Packet Header?

Each data packet carries extra information called a header.

Headers contain details needed for transmission, such as:

·         Source address

·         Destination address

·         Sequence information

·         Error checking data


🔵 TCP Header Structure

A TCP header contains 11 required fields (20 bytes):

1.      Source Port (2 bytes)

2.      Destination Port (2 bytes)

3.      Sequence Number (4 bytes)

4.      Acknowledgment Number (4 bytes)

5.      Data Offset

6.      Reserved Bits

7.      Control Flags

8.      Window Size

9.      Checksum

10.  Urgent Pointer

11.  Optional Data (0–40 bytes)


🟢 UDP Header Structure

UDP headers are simpler and only 8 bytes long.

Fields include:

1.      Source Port Number (2 bytes)

2.      Destination Port Number (2 bytes)

3.      Length Field (2 bytes)

4.      Checksum (2 bytes)

UDP is lightweight because it does not manage connection reliability.


🤝 TCP Three-Way Handshake

Before sending data, TCP creates a connection using a Three-Way Handshake.

Steps:

1️ Client sends SYN (request connection)
2️ Server replies with SYN + ACK (accept request)
3️ Client sends ACK (confirmation)

Connection established.


Control Flags Meaning

·         URG – Urgent data present

·         ACK – Acknowledgment received

·         PSH – Push data immediately

·         RST – Reset connection

·         SYN – Start connection

·         FIN – End connection


Why Handshake is Needed?

Both devices must confirm:

·         They can send data

·         They can receive data

·         Communication path is reliable

Only after verification does data transfer begin.


🌐 TCP vs UDP Examples

Protocol

Used For

TCP -----

Websites, Email, File Transfer

UDP -----

Video Calls, Streaming, Gaming


Summary

·         Data travels across networks as packets.

·         TCP provides reliable, ordered communication.

·         UDP provides faster but less reliable transmission.

·         Packet sniffing captures network traffic for analysis.

·         HTTPS encryption protects users from data interception.

·         TCP handshake ensures secure communication setup.

Also Read:

Introduction Of Virus, warms, intruders, insiders, criminal organizations, cyber terrorist, security attacks, phishing attack and SQL injection?

What is Security Attacks? What is Active and Passive Attack??

What is Sniffing and Sniffers ?

Post a Comment

0 Comments