I've briefly read up on both flow control and congestion control and I cannot understand why we need them both and not just congestion control.
Cannot we use just use congestion control and include the receiver as the last node? It seems to me that flow control could just be a special case of congestion control.
I've looked at this question, I think OP are having the same question as me, but question is not formulated well enough thus the answer are not complete.
Assume we are sending 100 packets but only the first five have been ACK-ed. How do the sender know if it's the network or the receiver that are slow? And should it actually matter? The network with the receiver is not capable of receiving fast enough so the sender should slow down.
What is the problem with an implementation going something like this?
if (acked() / sent() < THRESHOLD){
transmission_rate(0.5);
}else{
transmission_rate(SOME_RATE); // where SOME_RATE > 0
}
Is there something flow control does that congestion control does not that requires a flow control in the TCP protocol?