@codeitram
You can refer to above PDF posted by @Rupendra Choudhary
Important points from PDF are -
- Sender cannot have number of non acknowledged frames more than sender window size.
e.g. if sender window size is 1000 bytes , it cannot have unacknowledged bytes more than 1000
LastByteWritten – LastByteAcked <=MaxSendBuffer
AdvertisedWindow = MaxRcvBuffer -(LastByteRcvd - LastByteRead)
Advertised Window gives the amount of free space available in the receive buffer
e.g if maximum receiver window size is 1000 bytes and till 500 are received then 500 bytes are free space hence advertised window is 500.
3.TCP sender must adhere to Advertised Window from the receiver such that
LastByteSent – LastByteAcked <= AdvertisedWindow (answer to given question)
e.g if free space available is 500 bytes(advertised window), sender cannot have no. of unacknowledged bytes more than free space at that instant and also it is limited by 1000 which is .sender window size (from point 1)
4. if AdvertisedWindow – (LastByteSent– LastByteAcked) >0 then only sender can send more data
e.g.
advertised window(free space) is 500 bytes and unacknowledged data bytes are 300 then 500-300=200 i.e. 200>0 , sender can send more data
else if unacknowledged bytes are 500 and advertised window is also 500 then (500-500)=0….sender application has to block since receiver do not have free space.