0% found this document useful (0 votes)
1 views

Unit 2 CN

The Stop-and-Wait Protocol is a basic data communication method that ensures reliable data transfer by sending one frame at a time and waiting for an acknowledgment before sending the next. While simple and effective for small data transfers, it is inefficient for high-speed networks due to idle waiting times. Advanced protocols like Sliding Window, Go-Back-N, and Selective Repeat ARQ improve efficiency by allowing multiple frames to be sent before requiring acknowledgments.

Uploaded by

mp9024242
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Unit 2 CN

The Stop-and-Wait Protocol is a basic data communication method that ensures reliable data transfer by sending one frame at a time and waiting for an acknowledgment before sending the next. While simple and effective for small data transfers, it is inefficient for high-speed networks due to idle waiting times. Advanced protocols like Sliding Window, Go-Back-N, and Selective Repeat ARQ improve efficiency by allowing multiple frames to be sent before requiring acknowledgments.

Uploaded by

mp9024242
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

STOP AND WAIT PROTOCOL

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:

o If a frame is lost or damaged during transmission, the lack of an acknowledgment


triggers the sender to retransmit the frame.

Advantages:

 Simple to implement.

 Effective for small or low-speed data transfers.

Disadvantages:

 Inefficient for high-speed or large-volume data transfers because the sender remains idle
while waiting for acknowledgments.

 Introduces latency due to waiting for ACKs after each frame.

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 The sender transmits one frame (data packet) at a time.

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 The sender sets a timer after transmitting each frame.

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 To avoid confusion due to duplicate frames, a sequence number (usually 0 or 1) is


attached to each frame.

o The receiver uses this sequence number to differentiate new frames from
retransmissions.

Features

 Error Control:

o Uses error detection (e.g., checksums or CRC) to identify corrupted frames.

o Retransmits frames that are lost or received with errors.

 Flow Control:

o Ensures the sender transmits data at a pace manageable for the receiver.

Advantages
1. Simplicity:

o Easy to implement due to its straightforward operation.

2. Reliability:

o Guarantees accurate delivery by retransmitting lost or damaged frames.

Disadvantages

1. Inefficiency:

o The sender remains idle while waiting for an acknowledgment, leading to low
channel utilization.

o Ineffective for high-speed or long-distance networks with high latency.

2. Delay:

o Increased transmission time due to acknowledgment waiting and retransmissions.

Example

 A sender transmits a frame labeled with sequence number 0.

 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.

o Communication in low-speed or low-bandwidth networks.

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 protocol maintains a "window" of frames that can be sent or received.

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.

o Moves forward (slides) as acknowledgments are received.

3. Receiver’s Window:

o Tracks frames that can be accepted by the receiver.

o Ensures frames are processed in the correct order.

4. Acknowledgments:

o Acknowledgments (ACKs) can be cumulative, indicating that all previous frames have
been received correctly.

o Alternatively, selective ACKs may be used to indicate specific frames received.

Types of Sliding Window Protocols

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.

2. Selective Repeat ARQ:

o Only the erroneous frame is retransmitted, not the entire window.

o Requires additional buffering but improves efficiency.

Features
1. Improved Efficiency:

o Allows multiple frames to be in transit, maximizing bandwidth utilization.

2. Error and Flow Control:

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.

2. Efficient Error Recovery:

o Reduces the need for retransmissions, especially in Selective Repeat ARQ.

Disadvantages

1. Complexity:

o Implementation requires more memory and processing for managing windows and
buffering frames.

2. Out-of-Order Delivery:

o May occur in Selective Repeat ARQ, requiring reordering mechanisms.

Example

 Go-Back-N ARQ:

o Sender sends frames 1, 2, 3, and 4.

o If frame 2 is lost, the receiver discards subsequent frames and sends a negative
acknowledgment (NAK).

o The sender retransmits frames 2, 3, and 4.

 Selective Repeat ARQ:

o Sender sends frames 1, 2, 3, and 4.

o If frame 2 is lost, the receiver stores frames 3 and 4 and sends a NAK for frame 2.

o The sender retransmits only frame 2.

Applications

1. Reliable Data Transfer:


o Used in protocols like TCP for reliable communication over unreliable networks.

2. High-Speed Networks:

o Suitable for networks with high bandwidth-delay products.

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.

Go-Back-N Protocol in Computer Networks


The Go-Back-N (GBN) Protocol is a reliable data link layer protocol based on the Sliding Window
concept. It enhances the efficiency of data transmission by allowing the sender to send multiple
frames before receiving an acknowledgment, while incorporating error recovery mechanisms to
ensure reliable communication.

How It Works

1. Sender’s Window:

o Maintains a "window" of up to N frames that can be sent without waiting for an


acknowledgment.

o Frames within this window are unacknowledged but considered in progress.

2. Receiver’s Window:

o Always expects the next frame in sequence.

o If a frame arrives out of order, it is discarded, and no acknowledgment is sent.

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:

o The sender sets a timer for each transmitted frame.

o If no acknowledgment is received within the timeout period, the sender retransmits


all frames starting from the unacknowledged frame.
Features

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.

2. Simpler Receiver Logic:

o The receiver only processes frames in sequence, reducing complexity.

Disadvantages

1. Inefficiency in Error Recovery:

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:

o Errors in transmission can cause delays due to retransmission of multiple frames.

Example

 The sender's window size is 4, and it sends frames 1, 2, 3, and 4.

 If frame 2 is lost or arrives corrupted:

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.

o The sender retransmits frames 2, 3, and 4.

Applications

1. Data Communication:
o Used in environments with low error rates where retransmitting multiple frames is
acceptable.

2. Protocol Implementations:

o Commonly implemented in older protocols or systems where simpler error control


mechanisms suffice.

Comparison with Selective Repeat ARQ

 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.

Selective Repeat ARQ Protocol in Computer Networks


The Selective Repeat Automatic Repeat Request (ARQ) protocol is a data link layer protocol that
ensures reliable data transfer by retransmitting only those frames that are lost or received with
errors. It is an enhancement of the Go-Back-N protocol and is based on the Sliding Window
mechanism.

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 Maintains a sliding window of size N, allowing it to accept and buffer out-of-order


frames.

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:

o Efficient error recovery by retransmitting only erroneous or lost frames.

2. Flow Control:

o Sliding windows ensure that the sender does not overwhelm the receiver.

Advantages

1. High Efficiency:

o Only erroneous or lost frames are retransmitted, reducing bandwidth wastage.

2. Supports Out-of-Order Delivery:

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:

o Requires additional memory and processing at the receiver to buffer out-of-order


frames and manage the window.

2. Potential for Overhead:

o Each frame requires individual acknowledgment, which may increase overhead in


acknowledgment processing.

Example
 The sender's window size is 4, and it sends frames 1, 2, 3, and 4.

 If frame 2 is lost or arrives corrupted:

o The receiver sends ACKs for frames 1, 3, and 4 (indicating they were received out of
order).

o The sender retransmits only frame 2.

o Upon successful receipt of frame 2, the receiver processes all buffered frames
(frames 3 and 4).

Comparison with Go-Back-N ARQ

Feature Selective Repeat ARQ Go-Back-N ARQ

Only erroneous or lost


Retransmissions All frames after the error
frames

Receiver Buffering Buffers out-of-order frames Does not buffer

Efficiency High Moderate

Complexity High Low

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:

o Effective in environments with frequent errors, as it minimizes retransmissions.

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.

You might also like