Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP Window and Buffer - check my understanding?

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!

like image 745
Patrick Teen Avatar asked Jun 04 '13 21:06

Patrick Teen


People also ask

What is the purpose of TCP window?

What Is TCP Windowing? "TCP windowing" is what we call it when the Transmission Control Protocol (TCP) uses a sliding window protocol to mitigate problems with clients and servers trying to share segments of data that are too large or small, and therefore cannot transmit effectively.

What is a TCP buffer?

Simply put, a TCP Receive Window is a buffer on each side of the TCP connection that temporarily holds incoming data. The data in this buffer is sent to the application, clearing more room for incoming data.

What is windowing and buffering?

A window is a viewport onto a buffer. You can use multiple windows on one buffer, or several windows on different buffers. A buffer is a file loaded into memory for editing. The original file remains unchanged until you write the buffer to the file.

What does TCP window Full mean?

When you see TCP Window Full flags, it usually means that the sender is using the full capacity of the TCP flow, limited by the recipient's receive window. The network may have higher capacity.


1 Answers

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.

like image 83
user207421 Avatar answered Oct 15 '22 03:10

user207421