Complete the code to identify the flow control method where the sender waits for an acknowledgment after sending each frame.
if sender_waits_for_ack == [1]: method = "Stop-and-Wait"
In Stop-and-Wait flow control, the sender waits for an acknowledgment (True) after sending each frame before sending the next.
Complete the code to calculate the window size in sliding window flow control given the sequence number bits.
window_size = 2[1] - 1
The window size in sliding window flow control is calculated as 2 to the power of the number of sequence bits minus 1. For example, if sequence bits = 2, window size = 22 - 1 = 3.
Fix the error in the code that checks if the sender can send more frames in sliding window protocol.
if frames_sent < [1]: can_send = True else: can_send = False
The sender can send frames as long as the number sent is less than the window size. Using 'window_size' directly is correct.
Fill both blanks to create a dictionary comprehension that maps frame numbers to their acknowledgment status if the frame number is less than the window size.
{frame_num: status for frame_num, status in frames.items() if frame_num [1] window_size and status [2] 'sent'}The comprehension filters frames where the frame number is less than the window size and the status is exactly 'sent'.
Fill all three blanks to create a dictionary comprehension that maps sequence numbers (mod window size) to frame data for frames with status 'acknowledged'.
{(frame_num [1] window_size): data for frame_num, (data, status) in frames.items() if status [2] 'acknowledged' and frame_num [3] window_size}The comprehension uses modulo (%) to wrap sequence numbers, checks if status equals 'acknowledged', and filters frame numbers less than window size.