So guys, now let us try to understand the feedback mechanism of TCP using which the TCP implements
reliable data delivery.
Right.
So suppose we have a sending TCP A and we have a receiving TCP B, we are assuming that the connection
is duplex.
So there is a flow of data from TCP B to TCP A also.
So in fact, both the tcp's are sending and receiving TCP.
Now let us suppose that the Tcpa sends data segment to TCP IP.
Right.
The sequence number is 100 and the amount of application data is 100 bytes.
Now note that as soon as TCP Sender sends the TCP segment onto the network, it starts a timer called
Retransmission Timer.
So retransmission timer is started for every data segment the TCP sends on the network.
Now, let us assume that this data segment is successfully received by TCP.
So TCP B will acknowledge this segment by sending the acknowledgement segment with acknowledgment number
200.
Now, let us suppose that the segment number two that is acknowledgement will receive the TCP A.
Before the retransmission timer goes off.
So let us call this retransmission timer as t one and before the retransmission timer t one goes off,
the ack for the segment number one has been successfully received by TCP.
Therefore, the tree transmission timer t one is cancelled.
At this point of time.
The TCP will assume that the data segment number one, which it sent to the TCP B has been successfully
received by TCP B, Right.
Why?
It is assuming this because it has received the acknowledgement for the same before the retransmission
timer t one goes off.
So at this point of time, the TCP is now in a position to send a fresh new segment to the TCP.
So TCP A sends the next segment number three to the TCP.
Now you can see again that it starts the retransmission timer t t2 for the segment number three.
Now let us assume that TCP A has issued another segment that is segment number four onto the network.
So it starts the retransmission timer for this segment also.
Now note that you must be wondering whether TCP is allowed to send multiple segments at the same time.
The answer is yes.
It is not like that.
That until TCP receives the acknowledgment for the segment it has sent, the TCP cannot send a new segment.
There is no such rule like that.
A TCP can send multiple data segments, one after the other without having to wait for any acknowledgment.
So now let us assume in this example that Segment three has been successfully delivered to the recipient
TCP IP, but the segment number four has been lost in the network.
Now, in the beginning of this example, I said that the connection is duplex.
It means that TCP B will be interested in sending some data to the Tcpa.
So you can see that here in this segment.
Number five, the TCP B or Process B is sending its own application data to the process A as well as
it is also acknowledging the segment number three.
And since the segment number five contains an application data, therefore TCP B will start a retransmission
timer for segment number five.
Now, let us suppose that the segment number five has been successfully received by TCP A right now.
Segment number five also acknowledges the segment number three.
Right.
So because the TCP has received the acknowledgement for segment number three, it will cancel the retransmission
timer, which it started for segment number three.
Right.
So this particular timer has been cancelled here.
But now I will ask you one question.
Has TCP received the Ack for segment number four?
The TCP has to receive an acknowledgment number 400in order to acknowledge the segment.
Number four.
So now let us assume that the retransmission timer t three has been expired.
Right.
So here the retransmission timer t three has been expired.
It means that the TCP A now has to retransmit the segment number four again.
So you can see that with the help of retransmission timer, the TCP protocol implements the concept
of retransmission.
In this diagram, the green clock shows that the timer has been started.
The yellow clock shows that the timer has been cancelled and the red clock shows that the timer has
been fired.
So let us read out what I have written here.
Each time device A sends a message, it starts a timer called retransmission timer.
And same is true for device B also.
Device B or TCP B sends an acknowledgment back to device A when it receives a message.
Here message means data segment.
So that device A can conclude that the data segment that it transmitted towards the device B has been
successfully received by the device B, Right.
And if a data segment is lost, the timer goes off.
That is the timer expired.
And in that particular case, the sending TCP, in this case the device a retransmit, the same data
segment again.
Right.
Note that sequence number runs independently in the two directions.
For example, the first data segment, which is issued by TCP towards TCP A was the segment number five.
And in this segment number five, we have randomly chosen the sequence number 2000 for communication
from B to A.
So this is how TCP implements its reliable data delivery with the help of retransmission timers.