TCP Window and Buffer - check my understanding?

17,337

The window size represents the maximum number of bytes un-acknowledged bytes which the sender can send at one time.

No. It is the maximum number of unacknowledged bytes that can be in transit. When the sender hits that limit he must stop sending.

This size is agreed upon during connection.

No. It is adjusted dynamically in the protocol.

The TCP sender should keep track of the ACK with the lower sequence number, and also mark packets as ACKed when an ACK is received.

The sender should buffer data sent until it is acknowledged, at which point it can be discarded. If it isn't acknowledged it may be retransmitted etc.

If the lowest sequence number (which it is tracking) matches the first byte in the current window, slide the window to the right.

Any ACK contains a sequence number. All buffered send data below that sequence number can be discarded.

Now, my understanding of the receiver buffer...

This is used when a packet arrives out of order.

No, it is used when any in-order packet arrives. It stays there until read by the application. Out-of-order segments aren't necessarily buffered at all.

The data is placed into a buffer, and the receiver does not ACK it, rather it continues to ACK the last packet it received prior to the earliest out of order packet. This causes the sender to "fast" re-transmit the next packet after the duplicate ACK number.

More or less, but the buffering part is optional.

Share:
17,337
Patrick Teen
Author by

Patrick Teen

Updated on June 17, 2022

Comments

  • Patrick Teen
    Patrick Teen almost 2 years

    I'm currently experimenting with implementing unidirectional TCP and I would just like some clarification on the behaviour of the TCP sender/receiver window and receiving buffer.

    My understanding of the windowing process is as follows:

    The window size represents the maximum number of un-acknowledged bytes which the sender can send at one time.

    This size is agreed upon during connection.

    The TCP sender should keep track of the ACK with the lower sequence number, and also mark packets as ACKed when an ACK is received. If the lowest sequence number (which it is tracking) matches the first byte in the current window, slide the window to the right.

    Now, my understanding of the receiver buffer...

    This is used when a packet arrives out of order. The data is placed into a buffer, and the receiver does not ACK it, rather it continues to ACK the last packet it received prior to the earliest out of order packet. This causes the sender to "fast" re-transmit the next packet after the duplicate ACK number.

    Is this a correct understanding for both of these concepts and if not, please clarify.

    Thanks!