This animation illustrates the interaction between a TCP sender and receiver.
Both of them have an application and a send/receive buffer.
The application at the senders side tries to transmit a file with a certain size to the Receiver. The application at the receivers side consumes chunks of 2Kbytes (except the very last one) from the send/receive buffer at random time.
When a packet is received the ack always contains the number of bytes the receiver has left in his buffer (advertised window). If the sender gets a advertised window size of 0 he just sends 1 byte until the application on the receivers side has consumed and so there is some space in the receivers buffer.
coded by Johannes Kessler 2012