When the endpoints establish a TCP session, the Window size field in the TCP header will be used to signal the receiving buffer capacity and govern the amount of data that can be received and processed. Each endpoint will maintain a local receive window (RWND). This is the maximum amount of data the receiver can receive for buffering and processing. The endpoint will include this RWND value in the TCP header. The sender uses RWND as input to decide the Sliding window size. It can send TCP segments to a peer of size defined in the window size before waiting for an acknowledgment.
The sender endpoint maintains the sliding window by managing the number of outstanding TCP segments waiting for an acknowledgement. The sender slides the window towards the right as and when it receives the ACK for the segments it has sent and are waiting for acknowledgement...