What is the TCP flow control?
Before discussing what TCP flow control is, we will describe what is flow control in computer networks. When two hosts communicate with each other, one sends packets, and the other receives. Both may have different hosting hardware, software design, and processing speed. When the receiver is fast enough to process a message from the sender, before it gets the next, all is good. But what will happen if the receiver is slow and the sender is fast? The messages will keep adding to the receiver’s queue. After some time, messages will start dropping. To overcome a fast sender and a slow receiver problem, in Computer networks, there is a flow control technique.
Slow sender speedy receiver – No Flow Control, Fast sender, slow receiver – Flow control is required.
In the above diagram, we have an example of a slow receiver and fast sender. Here we will see how the messages will be overflow. The sender is sending messages at the rate of 10 messages per second while the receiver is receiving at the rate of 5 messages per second. When a sender sends a message, the network enqueues messages in the receiver queue. Once a message is read by the user application. The message is clear from the line, and now again, one buffer space adds to the free space.
With the mentioned speed for the sender and receiver, the receiver queue will keep shortening at the pace of 5 every second. Finally, after 40 seconds, there will be no space remaining for incoming messages, and messages will start dropping.
Why TCP flow control require?
TCP is an example of a transport layer protocol in the OSI Model. It provides reliable and sequenced delivery of messages. Because of reliable delivery, TCP does retry to send a lost segment if a packet is lost due to a slow receiver. If no flow control, TCP will keep resending again and again, and the situation will get worse on the computer network.
For the flow control, during the communication TCP receiver keep sending the available space capacity for the incoming messages. The receiver side updates the information and reduces the message sending rate.
Flow control in TCP?
For a TCP flow control, the sender should know how much free space is available on the receiving side before sending messages. In an earlier TCP header tutorial, we have described various protocol parameters. One parameter is the window size. Each TCP segments, each end adds the window size in the header.
At the time of connection setup, the window size is the maximum size of the window. During the communication, the window size keeps updating. When a TCP end, can not accept any more messages, the window size reaches zero. The receiver of a message with window size zero should not try to send any further messages. Till it gets again a message with a window size of nonzero.
Flow control and TCP user:
Till now all discussion was for the TCP layer. Here we will discuss the traffic source for TCP, which is the user of the layer.
Difference Between Flow Control and Congestion Control:
The flow control is between end to end. While congestion control is a node between the path from two nodes. For example, a router between two communicating nodes may get congested.
How does a TCP application know when to stop?
The purpose of flow control is to let the sender know that the receiver is slower. For that, a sender application should be informed in case of a slow receiver. Generally, the TCP module informs the sender, while sending data.