Computer Networks Essentials / Data Link Layer

Error Detection & Correction

πŸ€” What is an Error in Data Communication?

When data is transmitted over a network, it travels as signals (electrical, light, or radio).

During transmission, data may get changed unintentionally.

πŸ“Œ This unwanted change in data is called an Error.


🧠 Simple Example

Sender sends:

πŸ‘‰ 1011001

Receiver receives:

πŸ‘‰ 1011101 ❌ (one bit changed)

πŸ“Œ This is a data transmission error.


⚠️ Why Do Errors Occur?

Errors can occur due to:

  • πŸ”Œ Electrical noise

  • πŸ“‘ Signal interference

  • 🌧️ Weather conditions

  • πŸ“‰ Weak signals

  • πŸ’₯ Hardware faults

πŸ‘‰ Errors are unavoidable, but they can be detected and corrected.


🎯 Why Error Detection & Correction is Needed

Without error control:

  • Wrong data is accepted ❌

  • System crashes ❌

  • Financial loss ❌

With error control:

  • Errors are detected βœ”οΈ

  • Data is corrected or retransmitted βœ”οΈ

  • Communication becomes reliable βœ”οΈ


🧭 Two Main Concepts

There are two important approaches:

1️⃣ Error Detection

2️⃣ Error Correction

Let’s understand both clearly πŸ‘‡


πŸ” Error Detection

🧠 What is Error Detection?

Error detection is the process of identifying whether data is corrupted or not during transmission.

πŸ“Œ It detects the presence of error, but does not fix it.


🧠 What Happens After Detection?

  • Receiver informs sender

  • Sender retransmits the data

πŸ“Œ Used where retransmission is possible.


πŸ› οΈ Common Error Detection Techniques

1️⃣ Parity Check

2️⃣ Checksum

3️⃣ Cyclic Redundancy Check (CRC)


πŸ”’ 1. Parity Check

🧠 What is Parity Bit?

A parity bit is an extra bit added to data to make:

  • Number of 1s even (Even parity)

  • Number of 1s odd (Odd parity)

🧠 Example (Even Parity)

Data: 1011001 β†’ number of 1s = 4

Parity bit added: 0

Transmitted: 10110010

βœ… Advantages

  • Simple

  • Low overhead

❌ Disadvantages

  • Detects only single-bit errors

  • Cannot detect multiple-bit errors reliably


βž• 2. Checksum

🧠 What is Checksum?

Checksum is a value calculated by:

  • Adding data bits

  • Sending the result with data

πŸ“Œ Receiver recalculates checksum and compares.

🧠 Example

Sender:

  • Data blocks added β†’ checksum generated

Receiver:

  • Adds received blocks

  • If result matches β†’ no error

  • Else β†’ error detected ❌

βœ… Advantages

  • Better than parity

  • Simple to implement

❌ Disadvantages

  • Not 100% reliable

  • Some errors may go undetected

πŸ“Œ Used in TCP, UDP.


πŸ” 3. Cyclic Redundancy Check (CRC)

🧠 What is CRC?

CRC is a powerful error detection technique based on binary division.

πŸ“Œ A fixed binary number called generator polynomial is used.

🧠 How CRC Works (Simple Steps)

1️⃣ Data is treated as binary number

2️⃣ Divided by generator polynomial

3️⃣ Remainder is calculated

4️⃣ Remainder is appended to data

5️⃣ Receiver repeats division

6️⃣ If remainder = 0 β†’ no error βœ”οΈ

βœ… Advantages

  • Detects burst errors

  • Very reliable

  • Widely used

❌ Disadvantages

  • More complex

  • Computational overhead

πŸ“Œ Used in Ethernet, HDLC.


πŸ› οΈ Error Correction

🧠 What is Error Correction?

Error correction not only detects errors, but also fixes them at the receiver side.

πŸ“Œ No need to retransmit data.


🧭 Types of Error Correction

1️⃣ Forward Error Correction (FEC)

2️⃣ Automatic Repeat reQuest (ARQ)


πŸš€ 1. Forward Error Correction (FEC)

🧠 Explanation

Extra bits are added so receiver can:

  • Detect error

  • Correct error automatically

πŸ“Œ Used where retransmission is not possible.

🧠 Example

  • Satellite communication πŸ›°οΈ

  • Real-time audio/video πŸŽ₯

❌ Drawback

  • Adds more redundancy

  • Increases bandwidth usage


πŸ” 2. Automatic Repeat reQuest (ARQ)

🧠 Explanation

  • Error detected

  • Receiver requests retransmission

  • Sender resends data

πŸ“Œ Most commonly used method.


🧩 Types of ARQ

  • Stop-and-Wait ARQ

  • Go-Back-N ARQ

  • Selective Repeat ARQ

πŸ“Œ We’ll study these in Flow Control topic.


πŸ“Š Error Detection vs Error Correction

Feature

Error Detection

Error Correction

Purpose

Detect error

Detect & fix

Retransmission

Required

Not required

Complexity

Low

High

Overhead

Less

More


🧠 Where Are These Techniques Used?

  • Parity β†’ Simple systems

  • Checksum β†’ TCP / UDP

  • CRC β†’ Ethernet

  • FEC β†’ Satellite

  • ARQ β†’ Data Link & Transport layers


⭐ One-Line Summary

πŸ”Ή Error detection finds corrupted data, while error correction fixes errors to ensure reliable communication.