Bidirectional Protocols: Piggybacking

 

Bidirectional Protocols: Piggybacking

Introduction

The four transport-layer protocols discussed earlier (Simple Protocol, Stop-and-Wait, Go-Back-N, and Selective Repeat) are unidirectional protocols.

In these protocols:

  • Data packets flow in only one direction.
  • Acknowledgments (ACKs) flow in the opposite direction.

However, in real computer networks, communication is usually bidirectional. Both communicating devices exchange data simultaneously. This means that data packets and acknowledgments need to travel in both directions.

To improve the efficiency of bidirectional communication, a technique called Piggybacking is used.


What is a Bidirectional Protocol?

A bidirectional protocol allows both communicating devices to send and receive data at the same time.

For example,

Client  -------------------->  Server
        Data

Client  <--------------------  Server
             Data

Here,

  • the client sends data to the server,
  • the server also sends data to the client.

Since both sides send data, both sides must also send acknowledgments.


The Problem Without Piggybacking

Suppose

the client sends a packet to the server.

Client -----------------> Server

       Data Packet

The server sends an ACK separately.

Client <----------------- Server

          ACK

Now,

the server also wants to send its own data.

Client <----------------- Server

        Data Packet

Again,

the client sends another ACK.

Client -----------------> Server

           ACK

The communication becomes

Client -----------------> Server

      Data

Client <----------------- Server

      ACK

Client <----------------- Server

      Data

Client -----------------> Server

      ACK

Notice that

many packets carry only acknowledgments.

These ACK packets occupy bandwidth even though they contain almost no useful data.


What is Piggybacking?

Piggybacking is a technique in which an acknowledgment is attached to a data packet traveling in the opposite direction.

Instead of sending a separate ACK,

the receiver waits for a short time.

If it has data to send,

it places the acknowledgment inside that outgoing data packet.

Thus,

one packet carries both data and acknowledgment.


How Piggybacking Works

Assume

Step 1

Client sends

Packet 0

to the server.

Client -----------------> Server

      Packet 0

Step 2

The server receives Packet 0.

Normally,

it should immediately send

ACK 1

Instead,

it waits briefly.


Step 3

The server has its own data

Packet 10

to send.

Now it combines

Packet 10

+

ACK 1

into one packet.

Client <---------------- Server

Packet 10 + ACK 1

Step 4

The client receives

Packet 10

+

ACK 1

The client

  • accepts Packet 10
  • knows Packet 0 reached safely

using the same packet.


Packet Format

Without Piggybacking

Client ------------>

Data Packet
Client <------------

ACK Packet

With Piggybacking

Client <------------

Data Packet

+

ACK

One packet performs

two functions.


Advantages of Piggybacking

1. Reduces Network Traffic

Fewer ACK packets are transmitted.


2. Improves Bandwidth Utilization

Every packet carries useful information.

Bandwidth is used more efficiently.


3. Reduces Communication Overhead

Instead of

Data

ACK

only

Data + ACK

is transmitted.


4. Improves Throughput

Since fewer packets travel in the network,

more bandwidth becomes available for transmitting data.


5. Suitable for Bidirectional Communication

Piggybacking is useful when

both devices exchange data simultaneously.

Examples include

  • Client–Server communication
  • FTP
  • Remote login (SSH/Telnet)
  • Chat applications
  • Database communication

Disadvantages of Piggybacking

1. ACK May Be Delayed

If the receiver has no data to send,

it cannot wait indefinitely.

Otherwise,

the sender may assume the packet is lost.


2. Requires a Timer

The receiver starts a piggyback timer.

If no outgoing data becomes available before the timer expires,

a separate ACK is transmitted.


3. Slightly More Complex

The protocol must decide

  • whether to wait,
  • how long to wait,
  • when to send a separate ACK.

Piggybacking Timer

Suppose

the server receives Packet 5.

The server has no data.

Instead of immediately sending

ACK 6

it waits for a short interval.

Two cases are possible.


Case 1

Server gets data before timeout.

Packet 10

+

ACK 6

is sent together.


Case 2

No data arrives before timeout.

The timer expires.

The server sends

ACK 6

alone.

This prevents unnecessary retransmissions.


Bidirectional Go-Back-N Using Piggybacking

In a bidirectional implementation of the Go-Back-N Protocol,

both the client and the server maintain

  • one send window, and
  • one receive window.

Thus,

each device has

Client

Send Window

Receive Window
Server

Send Window

Receive Window

Both devices can

  • send packets,
  • receive packets,
  • acknowledge received packets,
  • receive acknowledgments,

at the same time.

Piggybacking combines outgoing data and acknowledgments into a single packet, reducing the number of packets transmitted.




Piggybacking vs Separate ACK

Without PiggybackingWith Piggybacking
Data and ACK sent separately    ACK attached to outgoing data
More packets transmitted    Fewer packets transmitted
Higher overhead    Lower overhead
Lower bandwidth utilization    Better bandwidth utilization
Simpler implementation        Slightly more complex implementation

Real-Life Analogy

Imagine two friends exchanging letters.

Without Piggybacking

  • Person A sends a letter.
  • Person B immediately sends a postcard saying "I received your letter."
  • Later Person B sends another letter.

This requires two separate mail deliveries.


With Piggybacking

  • Person A sends a letter.
  • Person B writes a reply letter.
  • Inside the reply letter, Person B also writes "I received your previous letter."

Now one letter performs two functions:

  • Reply to the previous message.
  • Acknowledge receipt of the earlier letter.

This saves postage, time, and effort—just as piggybacking saves bandwidth and network overhead.


Summary

  • Piggybacking is a technique used in bidirectional transport protocols to improve communication efficiency.
  • Instead of sending a separate acknowledgment (ACK), the receiver attaches the ACK to an outgoing data packet traveling in the opposite direction.
  • This reduces the number of packets transmitted, improves bandwidth utilization, lowers communication overhead, and increases overall throughput.
  • If no outgoing data is available before a short piggyback timer expires, the receiver sends a separate ACK to avoid unnecessary retransmissions.
  • In bidirectional Go-Back-N, both the client and the server maintain independent send and receive windows, allowing simultaneous transmission of data and acknowledgments.

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)