Unit 2 CN
Unit 2 CN
The Stop-and-Wait Protocol is a simple data communication protocol used in computer networks to
ensure reliable data transfer between sender and receiver. It operates on the Automatic Repeat
Request (ARQ) mechanism, using acknowledgment messages to confirm successful delivery.
Key Features:
1. Data Transmission:
o The sender transmits one frame (data packet) at a time and waits for an
acknowledgment (ACK) from the receiver before sending the next frame.
2. Acknowledgment:
o The receiver sends an ACK back to the sender upon successful receipt of the frame.
o If the sender does not receive an ACK within a specified time (timeout), it
retransmits the same frame.
3. Flow Control:
o Ensures that the sender does not overwhelm the receiver by sending frames at a
rate faster than the receiver can process.
4. Error Control:
Advantages:
Simple to implement.
Disadvantages:
Inefficient for high-speed or large-volume data transfers because the sender remains idle
while waiting for acknowledgments.
Example in Use:
Consider a file transfer. The sender transmits one chunk of the file, waits for confirmation from the
receiver, and proceeds to the next chunk only after the previous one is acknowledged. This ensures
data is transferred accurately but may slow down overall throughput.
This protocol is foundational in networking and lays the groundwork for more advanced
communication techniques like sliding window protocols.
Stop-and-Wait ARQ Protocol in Computer Networks
The Stop-and-Wait Automatic Repeat Request (ARQ) protocol is a fundamental error-control
mechanism used in computer networks to ensure reliable data transmission between a sender and a
receiver. It is a variation of the Stop-and-Wait Protocol, enhanced with error detection and
retransmission capabilities.
How It Works
1. Data Transmission:
o After sending, the sender waits for an acknowledgment (ACK) from the receiver
before sending the next frame.
2. Acknowledgment:
o The receiver sends an acknowledgment (ACK) if the frame is received without errors.
o If the frame is damaged or lost, the receiver does not send an ACK, prompting the
sender to retransmit the frame after a timeout.
3. Timeout Mechanism:
o If the timer expires without receiving an ACK, the sender assumes the frame was lost
or corrupted and retransmits it.
4. Sequence Numbers:
o The receiver uses this sequence number to differentiate new frames from
retransmissions.
Features
Error Control:
Flow Control:
o Ensures the sender transmits data at a pace manageable for the receiver.
Advantages
1. Simplicity:
2. Reliability:
Disadvantages
1. Inefficiency:
o The sender remains idle while waiting for an acknowledgment, leading to low
channel utilization.
2. Delay:
Example
If the receiver successfully receives the frame, it sends an acknowledgment (ACK 0).
The sender then transmits the next frame (sequence number 1).
If an acknowledgment is not received within the timeout period, the sender retransmits the
frame.
Applications
Stop-and-Wait ARQ is often used in scenarios where data integrity is more critical than
speed, such as:
o File transfers.
Conclusion
The Stop-and-Wait ARQ protocol is a basic but reliable method for ensuring accurate data
transmission. However, its inefficiency in utilizing available bandwidth makes it less suitable for
modern high-speed networks, where more advanced protocols like Sliding Window ARQ are
preferred.
Sliding Window Protocol in Computer Networks
The Sliding Window Protocol is a data link layer protocol used in computer networks to manage
efficient and reliable data transmission between sender and receiver. It addresses the limitations of
the Stop-and-Wait protocol by allowing multiple frames to be transmitted before requiring an
acknowledgment, thereby improving channel utilization.
How It Works
1. Window Concept:
o The window size determines the maximum number of frames that can be sent
without waiting for an acknowledgment.
2. Sender’s Window:
o Tracks frames that have been sent but not yet acknowledged.
3. Receiver’s Window:
4. Acknowledgments:
o Acknowledgments (ACKs) can be cumulative, indicating that all previous frames have
been received correctly.
1. Go-Back-N ARQ:
o If an error occurs, the sender retransmits the erroneous frame and all subsequent
frames in the window.
o Simple but inefficient for networks with high latency or error rates.
Features
1. Improved Efficiency:
o Manages retransmissions for erroneous frames and regulates data flow between
sender and receiver.
Advantages
1. High Throughput:
o Enables continuous data transmission, reducing idle time for the sender.
Disadvantages
1. Complexity:
o Implementation requires more memory and processing for managing windows and
buffering frames.
2. Out-of-Order Delivery:
Example
Go-Back-N ARQ:
o If frame 2 is lost, the receiver discards subsequent frames and sends a negative
acknowledgment (NAK).
o If frame 2 is lost, the receiver stores frames 3 and 4 and sends a NAK for frame 2.
Applications
2. High-Speed Networks:
Conclusion
The Sliding Window Protocol is a cornerstone of reliable data communication, offering significant
improvements in efficiency over simpler protocols like Stop-and-Wait. By allowing multiple frames to
be in transit and supporting advanced error control mechanisms, it is widely used in modern
networking scenarios.
How It Works
1. Sender’s Window:
2. Receiver’s Window:
3. Acknowledgments:
o The receiver sends cumulative acknowledgments (ACKs) for the last correctly
received frame in sequence.
o If a frame is lost or arrives corrupted, the receiver stops sending ACKs, causing the
sender to retransmit the lost frame and all subsequent frames in the window.
4. Timeout Mechanism:
1. Error Control:
o Lost or corrupted frames trigger retransmission of the entire window from the first
unacknowledged frame.
2. Flow Control:
o The size of the sender’s window is determined by the receiver’s buffer capacity to
prevent overflow.
Advantages
1. Increased Throughput:
o Multiple frames are sent before waiting for an acknowledgment, reducing idle time
for the sender.
Disadvantages
o If a single frame is lost or corrupted, all subsequent frames in the window are
retransmitted, even if they were received correctly.
2. Higher Latency:
Example
o The receiver discards frames 3 and 4 because they are out of sequence.
o The receiver sends an acknowledgment (ACK 1) for the last correctly received frame.
Applications
1. Data Communication:
o Used in environments with low error rates where retransmitting multiple frames is
acceptable.
2. Protocol Implementations:
Unlike Go-Back-N, Selective Repeat retransmits only the erroneous frame, making it more
efficient for high-latency or high-error-rate networks. However, GBN is simpler to implement.
Conclusion
The Go-Back-N protocol strikes a balance between simplicity and efficiency for reliable data
communication. While its retransmission strategy can lead to inefficiencies in error-prone networks,
it remains an effective solution in scenarios where errors are infrequent or low-latency
communication is not critical.
How It Works
1. Sender’s Window:
o Maintains a sliding window of size N, which tracks frames that have been sent but
not yet acknowledged.
o Frames within the window can be sent continuously without waiting for individual
acknowledgments.
2. Receiver’s Window:
o If a frame is received out of order, it is stored until the missing frame(s) arrive.
3. Acknowledgments:
o The receiver sends a positive acknowledgment (ACK) for each correctly received
frame.
o If a frame is damaged or lost, the receiver does not send an acknowledgment for
that frame, prompting the sender to retransmit it.
4. Retransmissions:
o Only the frames that are not acknowledged are retransmitted, saving bandwidth
compared to protocols like Go-Back-N.
Features
1. Error Control:
2. Flow Control:
o Sliding windows ensure that the sender does not overwhelm the receiver.
Advantages
1. High Efficiency:
o The receiver can accept and buffer frames that arrive out of order, ensuring
continuity in communication.
3. Improved Throughput:
o The protocol is well-suited for high-speed networks with low error rates, where
retransmission of all frames (as in Go-Back-N) would be inefficient.
Disadvantages
1. Increased Complexity:
Example
The sender's window size is 4, and it sends frames 1, 2, 3, and 4.
o The receiver sends ACKs for frames 1, 3, and 4 (indicating they were received out of
order).
o Upon successful receipt of frame 2, the receiver processes all buffered frames
(frames 3 and 4).
Applications
1. High-Speed Networks:
o Suitable for networks with high bandwidth-delay products, where retransmitting all
frames would be inefficient.
2. Error-Prone Environments:
Conclusion
The Selective Repeat ARQ protocol is a sophisticated and efficient solution for reliable data
transmission in modern networks. By retransmitting only erroneous frames and supporting out-of-
order delivery, it significantly improves throughput and bandwidth utilization. However, its
complexity makes it more challenging to implement than simpler protocols like Go-Back-N.