0
0
Computer Networksknowledge~10 mins

TCP flow control (sliding window) in Computer Networks - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - TCP flow control (sliding window)
Sender has data to send
Check window size
Send data
Wait for ACK
Receive ACK
Slide window forward
More data to send?
NoEnd
Back to Check window size
The sender checks if it can send data within the allowed window size, sends data if possible, waits for acknowledgments, and slides the window forward to send more data.
Execution Sample
Computer Networks
Window size = 4
Send packets 1,2,3,4
Receive ACK for packet 1
Slide window
Send packet 5
This example shows sending 4 packets within the window, receiving an ACK for the first packet, sliding the window, and sending the next packet.
Analysis Table
StepActionWindow StartWindow EndPackets SentACK ReceivedWindow SlidesNext Packet to Send
1Initialize window14NoneNoneNo1
2Send packets within window141,2,3,4NoneNo5
3Receive ACK for packet 1141,2,3,41Yes5
4Slide window forward by 1251,2,3,41Yes5
5Send next packet within window252,3,4,51No6
6Receive ACK for packet 2252,3,4,52Yes6
7Slide window forward by 1362,3,4,52Yes6
8Send next packet within window363,4,5,62No7
9No more ACKs received363,4,5,6NoneNo7
10Window full, wait for ACK363,4,5,6NoneNo7
💡 Sender waits because window is full and no new ACKs received to slide window.
State Tracker
VariableStartAfter Step 2After Step 4After Step 5After Step 7Final
Window Start112233
Window End445566
Packets SentNone1,2,3,41,2,3,42,3,4,52,3,4,53,4,5,6
ACK ReceivedNoneNone1122
Next Packet to Send155667
Key Insights - 3 Insights
Why does the sender stop sending new packets even if it has more data?
Because the window is full (see Step 10 in execution_table), the sender must wait for ACKs to slide the window before sending more packets.
What does sliding the window mean in this context?
Sliding the window means moving the window start and end forward after receiving ACKs (see Steps 3 and 4), allowing the sender to send new packets.
Why is the next packet to send updated only after sliding the window?
Because the sender can only send packets within the current window range; sliding the window opens space for new packets (see Steps 4 and 5).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at Step 3. What packet ACK is received?
APacket 4
BPacket 1
CPacket 2
DNo ACK received
💡 Hint
Check the 'ACK Received' column at Step 3 in execution_table.
At which step does the window slide forward for the first time?
AStep 4
BStep 2
CStep 5
DStep 10
💡 Hint
Look for 'Window Slides' marked 'Yes' and the window start changing in execution_table.
If the sender receives no ACKs after Step 8, what happens next?
ASender continues sending new packets
BSender slides window forward anyway
CSender waits because window is full
DSender resets the connection
💡 Hint
See Steps 9 and 10 where no ACKs are received and the sender waits.
Concept Snapshot
TCP sliding window controls data flow by limiting unacknowledged packets.
Sender can send packets within the window size.
ACKs slide the window forward, allowing more packets to be sent.
If window is full, sender waits for ACK before sending more.
This prevents overwhelming the receiver and network.
Full Transcript
TCP flow control uses a sliding window to manage how much data the sender can transmit before needing an acknowledgment. The sender starts with a window size that defines how many packets it can send without waiting. It sends packets within this window and waits for acknowledgments (ACKs) from the receiver. When an ACK is received for the earliest packet, the window slides forward by one, allowing the sender to send the next packet. If the window is full and no ACKs are received, the sender must wait before sending more data. This mechanism ensures smooth data flow and prevents network congestion or receiver overload.