3

I was learning TCP from Forouzan's book. It explains sender side window as follows:

enter image description here

In that it defines size of receiver window as follows:

rwnd = receiver buffer size - number of bytes waiting to be consumed by receiver process

It then says:

  • Sender side window closes (moves left wall of windows to right), when it receives some acknowledgements
  • sender side window opens (moves right wall to right), when receiver communicates rnwd such that
    new ackNo + new rwnd > old ackNo + last rwnd
  • The send window shrinks (moves right window to right) in the event above situation does not occur.

It shows opening and closing of sender window as follows:

enter image description here

It does not show shrinking of window. I dont get why shrinking will ever occur. If you look at formula for rwnd in first quoted text above, shrinking will require reduction of receiver buffer size, correct? If yes does that happen (I feel this buffer size must be fixed)? And if yes why? Due to reduction of free RAM of the computer running TCP receiver?

  • Generally, shrinking the send windows happens on two occasions: network congestion (RTT spiking) or when signaled by the receiver (receive buffer filling up). – Zac67 Oct 19 '19 at 16:45
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Dec 15 '19 at 19:41
1

The receive buffer could be a fixed size, and that really plays no part in the receive window, except to place an absolute maximum on the receive window size. The real definition of a receive window is to be found in RFC 793, Transmission Control Protocol, which is the definition of TCP. The receive window is explained in several places in the RFC. For example:

Flow Control:

TCP provides a means for the receiver to govern the amount of data sent by the sender. This is achieved by returning a "window" with every ACK indicating a range of acceptable sequence numbers beyond the last segment successfully received. The window indicates an allowed number of octets that the sender may transmit before receiving further permission.

Assume that the receiver has a fixed buffer size of 10,000 bytes and starts with a receive window of that size. If it has received 4,000 bytes, but the application process has not yet consumed those bytes from the receive buffer, TCP will acknowledge the received bytes, but specify the receive window is now 6,000 bytes because that is all that is left in the buffer. The receiver is telling the sender that it should stop sending more data after it sends 6,000 more bytes, unless the receiver gives it a different receive window size. Remember, TCP is a process that is not the application process, and TCP will maintain the connection and the receive window based on its available resources, which are filled until the application process gets around to consuming the data and freeing TCP resources.

It does not show shrinking of window.

The diagram seems to show the send window shrinking and expanding (800 to 600 to 400, and back to 600 on the client). It also shows the receive window (on the server) shrinking as data are received, until the application process consumes some data from TCP, at which point the receive window grows by the amount consumed.


TCP doesn't have clients or servers, it creates connections between two peers, so I'm not sure why the book implies that; it only serves to confuse things. In this case, the client is the sender, and the server is the receiver, and that is backwards from what many people use. Either TCP peer can both send and receive (each is a sender and a receiver). The RFC for TCP doesn't mention clients or servers.

| improve this answer | |
  • 2
    Thats not what author call as "shrinking" of window. Author calls it "closing" of window. There are three definitions in 2nd quoted text: open, close and shrink. I have bold faced them now. I have also highlighted them in red underline in the 2nd diagram. I have also highlighted the difference between closing and shrinking of window in first diagram with red underline. – anir Oct 19 '19 at 19:03
  • As I explained, RFC 793 is the TCP definition, and it is what you should refer to for TCP behavior. We cannot answer for the author and his interpretation. You can contact the author for clarification of what he means, but we can help with the actual TCP theory, which I have explained. – Ron Maupin Oct 19 '19 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.