Error Control in the Transport Layer

 

Error Control in the Transport Layer

Introduction

The Internet Protocol (IP) used at the Network Layer is an unreliable, connectionless protocol. It provides only best-effort delivery, which means that it attempts to deliver packets but does not guarantee that they will reach the destination correctly, in order, or even at all.

Therefore, if an application (such as web browsing, file transfer, or email) requires reliable communication, the Transport Layer must provide Error Control mechanisms.

Error control ensures that the data received by the destination is accurate, complete, and in the correct order.


Definition

Error Control is a mechanism used by the Transport Layer to detect transmission errors, recover lost packets, eliminate duplicate packets, and ensure that packets are delivered in the correct order.

Unlike flow control, which prevents the receiver from being overwhelmed, error control focuses on maintaining the correctness and reliability of data transmission.


Why is Error Control Needed?

During transmission through the Internet, packets may suffer from several problems:

  • Packets may become corrupted due to noise.
  • Packets may be lost because of network congestion.
  • Packets may arrive out of order due to different routing paths.
  • Duplicate packets may be created due to retransmissions.

Without error control, these problems would result in incomplete or incorrect data at the receiver.


Functions of Error Control

According to the transport layer, error control performs four major functions.

1. Detecting and Discarding Corrupted Packets

A packet may become damaged while traveling through the network.

Example

Sender

Packet 5

↓

Internet

↓

Packet becomes corrupted

↓

Receiver

The receiver detects the corruption (using mechanisms such as a checksum) and discards the corrupted packet instead of delivering incorrect data to the application.


2. Detecting Lost Packets and Requesting Retransmission

Sometimes packets never reach the destination.

Example

Packet 1   ✓

Packet 2   Lost

Packet 3   ✓

The receiver realizes that Packet 2 is missing and the sender retransmits it after detecting the loss (typically using a timeout and acknowledgment mechanism).

This ensures that no data is permanently lost.


3. Detecting Duplicate Packets

Sometimes the sender retransmits a packet because it did not receive an acknowledgment, even though the receiver had already received it.

Example

Packet 5

↓

Receiver receives it

↓

ACK is lost

↓

Sender retransmits Packet 5

↓

Receiver receives Packet 5 again

The receiver recognizes that it is a duplicate packet and simply discards it.


4. Reordering Out-of-Order Packets

Packets may travel through different routes in the network.

As a result,

Sent Order

1 → 2 → 3 → 4 → 5

but the receiver may obtain

Received Order

1 → 3 → 2 → 5 → 4

The transport layer stores the out-of-order packets temporarily and delivers them to the application only after arranging them in the correct order.


Error Control Architecture

Unlike flow control, error control involves only the transport layers of the sender and receiver.

        

The application layer is assumed to generate error-free messages.

The receiver informs the sender whenever an error occurs.


Sequence Numbers

What are Sequence Numbers?

To identify every packet uniquely, the transport layer assigns a sequence number to each packet.

These numbers help the receiver determine

  • which packet has been lost,
  • which packet is duplicated,
  • and whether packets have arrived in the correct order.

Example

Packet      Sequence Number

Packet A          0

Packet B          1

Packet C          2

Packet D          3

If Packet 2 is missing,

Receiver gets

0

1

3

The receiver immediately knows that Packet 2 has been lost.


Detecting Different Errors Using Sequence Numbers

Lost Packet

Sent

0   1   2   3

Received

0   1       3

Since sequence number 2 is missing,

the receiver detects a lost packet.


Duplicate Packet

Received

0

1

2

2

3

Sequence number 2 appears twice.

The second copy is discarded.


Out-of-Order Packet

Received

0

2

1

3

Since the numbers are not in order,

the receiver buffers the packets until the missing packet arrives.


Sequence Number Field

The sequence number is stored in the transport-layer header.

Suppose

Sequence Number Field = m bits

Then the available sequence numbers are

0 to (2^m – 1)

Example

If

m = 4 bits

Then

2^4 = 16 sequence numbers

Available numbers

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

After reaching 15,

the numbering starts again from 0.

0 1 2 3 ... 15 0 1 2 3 ...

This is called Modulo 2m2^m numbering.

Sequence Numbers

0 → 1 → 2 → ... → 15

↓

Wrap Around

0 → 1 → 2 ...

Why Wrap Around?

Since only a limited number of bits are available in the header, sequence numbers cannot increase indefinitely. After reaching the maximum value, numbering restarts from 0. The sender and receiver use protocol rules to distinguish new packets from older ones.


Acknowledgment (ACK)

What is an Acknowledgment?

An Acknowledgment (ACK) is a control message sent by the receiver to inform the sender that a packet has been received correctly.

Instead of sending negative messages for every error, transport protocols such as TCP generally use positive acknowledgments.


Working of ACK

Step 1

Sender sends Packet 1.

Sender

Packet 1

↓

Receiver

Step 2

Receiver successfully receives Packet 1.

Receiver

↓

ACK

Step 3

Sender receives ACK.

Sender

ACK Received

↓

Send Next Packet

Timer-Based Retransmission

After sending a packet,

the sender starts a timer.

Send Packet

↓

Start Timer

Two situations are possible.


Case 1: ACK Arrives Before Timeout

Packet

↓

Receiver

↓

ACK

↓

Sender

Timer Stops

Communication continues normally.


Case 2: ACK Does Not Arrive

Packet

↓

Lost

↓

No ACK

↓

Timer Expires

↓

Sender Retransmits Packet

This mechanism ensures that lost packets are retransmitted automatically.


Handling Duplicate Packets

Suppose

Packet 5 reaches the receiver,

but the ACK is lost.

Packet 5

↓

Receiver

↓

ACK Lost

The sender assumes the packet was lost and retransmits it.

Packet 5 Again

Since the receiver already has Packet 5,

it recognizes the duplicate using the sequence number and simply discards it.


Handling Out-of-Order Packets

Suppose

Packets are sent

1 → 2 → 3 → 4

Received

1 → 3 → 4

Packet 2 is missing.

The receiver stores Packets 3 and 4 in a buffer.

When Packet 2 finally arrives,

1 → 2 → 3 → 4

the receiver delivers all packets to the application in the correct order.


Complete Error Control Process

Sender Transport Layer

Assign Sequence Numbers

        │

Send Packets

        │

Internet

        │

Receiver Transport Layer

Checks Sequence Numbers

        │

Detects Errors

        │

Sends ACK

        │

If ACK Missing

↓

Sender Retransmits Packet

Flow Control vs Error Control

FeatureFlow ControlError Control
PurposeControls transmission rateEnsures reliable delivery
PreventsReceiver overloadCorrupted, lost, duplicate, and out-of-order packets
UsesBuffers and receiver feedbackSequence numbers, ACKs, timers, checksums
CommunicationBetween sender/receiver transport layers and applicationOnly between sender and receiver transport layers

Advantages of Error Control

  • Ensures reliable data transmission.
  • Detects and discards corrupted packets.
  • Retransmits lost packets.
  • Eliminates duplicate packets.
  • Delivers packets in the correct order.
  • Maintains data integrity and correctness.

Summary

  • Error Control is a transport-layer mechanism that provides reliable communication over the unreliable IP network.
  • It performs four main functions: detecting and discarding corrupted packets, recovering lost packets through retransmission, detecting and discarding duplicate packets, and buffering out-of-order packets until missing packets arrive.
  • Sequence numbers uniquely identify packets and help detect loss, duplication, and out-of-order delivery. If the sequence number field is m bits, the numbering ranges from 0 to 
    2m12^m - 12m2^m
  • Positive acknowledgments (ACKs) inform the sender that packets have been received correctly. The sender uses a timer; if an ACK is not received before the timer expires, the packet is retransmitted.
  • Together, sequence numbers, acknowledgments, timers, and buffering enable the transport layer to deliver data accurately, completely, and in the correct order.

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)