title: TCP Window and Buffer - check my understanding?
body: <p>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.</p>
  
  <p><em>My understanding of the windowing process is as follows:</em></p>
  
  <p>The window size represents the maximum number of un-acknowledged bytes which the sender can send at one time. </p>
  
  <p>This size is agreed upon during connection.</p>
  
  <p>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.</p>
  
  <p><em>Now, my understanding of the receiver buffer...</em></p>
  
  <p>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.</p>
  
  <p>Is this a correct understanding for both of these concepts and if not, please clarify.</p>
  
  <p>Thanks!</p>