0% found this document useful (0 votes)
75 views5 pages

TCP Flow Control

Uploaded by

kethanayatti7008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views5 pages

TCP Flow Control

Uploaded by

kethanayatti7008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Here’s how TCP flow control works:

1. Host B Advertises rwnd:


 Host B has a buffer to store incoming data from Host A.
 rwnd (Receive Window) tells Host A how much free space is left in this
buffer.
 Host B includes the value of rwnd in the acknowledgments it sends to
Host A.

2. Host A Adjusts Its Sending Rate:

 Host A sends data to Host B.


 Host A keeps track of:
o LastByteSent: The last byte it has sent.
o LastByteAcked: The last byte Host B has acknowledged as
received.

 The difference:

LastByteSent−LastByteAcked

is the unacknowledged data still in transit to Host B.

 Key Rule: Host A ensures that the unacknowledged data is less than or
equal to the free space in Host B’s buffer (rwnd):

LastByteSent−LastByteAcked≤rwnd

This prevents Host A from sending too much data and overflowing Host
B’s buffer.

Example:
1. Suppose Host B has a receive buffer of size 10,000 bytes (RcvBuffer =
10,000).
2. LastByteRcvd = 5,000: This means 5,000 bytes have been received and
stored in the buffer.
3. LastByteRead = 2,000: This means the application process on Host B
has consumed (read) only 2,000 bytes from the buffer.
4. Buffer-usage: LastByteRcvd−LastByteRead=5,000−2,000=3,000 bytes
5. Free-space-(rwnd):

rwnd=RcvBuffer−
(LastByteRcvd−LastByteRead)=10,000−3,000=7,000byt
es

Host B will advertise this value (rwnd = 7,000) to Host A in the next
acknowledgment.
Steps in Communication

1. First Segment: Client to Server

 Host A sends the letter 'C' (1 byte) to Host B.


 Sequence number: 42 (first byte being sent).
 Acknowledgment number: 79 (waiting for the first byte from Host B).

2. Second Segment: Server to Client

 Host B sends two things:


1. Acknowledgment: Confirms it received the letter 'C'.
Acknowledgment number: 43 (next byte it expects from Host A).
2. Echo: Sends back the letter 'C' to Host A.
 Sequence number: 79 (first byte Host B is sending).
3. Third Segment: Client to Server

 Host A sends an acknowledgment for the echoed letter 'C'.


 Sequence number: 43 (to keep the numbering in order, even though no
new data is sent).
 Acknowledgment number: 80 (next byte it expects from Host B).

You might also like