web analytics

Error Recovery and Reliability

TCP provides for reliable data transfer, which is also called reliability or error recovery,
depending on what document you read. To accomplish reliability, TCP numbers data bytes
using the Sequence and Acknowledgment fields in the TCP header. TCP achieves reliability
in both directions, using the Sequence Number field of one direction combined with the
Acknowledgment field in the opposite direction.

Figure 5-7 shows an example of how the TCP sequence and acknowledgment fields allow
the PC to send 3000 bytes of data to the server, with the server acknowledging receipt of
the data. The TCP segments in the figure occur in order, from top to bottom. For simplicity’s
sake, all messages happen to have 1000 bytes of data in the data portion of the TCP
segment. The first Sequence number is a nice round number (1000), again for simplicity’s
sake. The top of the figure shows three segments, with each sequence number being 1000
more than the previous, identifying the first of the 1000 bytes in the message. (That is, in
this example, the first segment holds bytes 1000–1999; the second holds bytes 2000–2999;
and the third holds bytes 3000–3999.)
Free CISCO CCNA Routing and Switching ICND1 Study Guide
Figure 5-7 TCP Acknowledgment Without Errors

The fourth TCP segment in the figure—the only one flowing back from the server to the
web browser—acknowledges the receipt of all three segments. How? The acknowledgment
value of 4000 means “I received all data with sequence numbers up through one less than
4000, so I am ready to receive your byte 4000 next.” (Note that this convention of acknowledging
by listing the next expected byte, rather than the number of the last byte received, is
called forward acknowledgment.)

This first example does not recover from any errors, however; it simply shows the basics of
how the sending host uses the sequence number field to identify the data, with the receiving
host using forward acknowledgments to acknowledge the data. The more interesting
discussion revolves around how to use these same tools to do error recovery. TCP uses the
sequence and acknowledgment fields so that the receiving host can notice lost data, ask the
sending host to resend, and then acknowledge that the re-sent data arrived.

Many variations exist for how TCP does error recovery. Figure 5-8 shows just one such
example, with similar details compared to the previous figure. The web browser again sends
three TCP segments, again 1000 bytes each, again with easy-to-remember sequence numbers.
However, in this example, the second TCP segment fails to cross the network.
Free CISCO CCNA Routing and Switching ICND1 Study Guide

Figure 5-8 TCP Acknowledgment with Errors
The figure points out three sets of ideas behind how the two hosts think. First, on the right,
the server realizes that it did not receive all the data. The two received TCP segments contain
bytes numbered 1000–1999 and 3000–3999. Clearly, the server did not receive the
bytes numbered in between. The server then decides to acknowledge all the data up to the
lost data—that is, to send back a segment with the acknowledgment field equal to 2000.

The receipt of an acknowledgment that does not acknowledge all the data sent so far tells
the sending host to resend the data. The PC on the left may wait a few moments to make
sure no other acknowledgments arrive (using a timer called the retransmission timer), but
will soon decide that the server means “I really do need 2000 next—resend it.” The PC on
the left does so, as shown in the fifth of the six TCP segments in the figure.

Finally, note that the server can acknowledge not only the re-sent data, but any earlier data
that had been received correctly. In this case, the server received the re-sent second TCP segment
(the data with sequence numbers 2000–2999), but the server had already received the
third TCP segment (the data numbered 3000–3999). The server’s next acknowledgment field
acknowledges the data in both those segments, with an acknowledgment field of 4000.

Subscribe To Get

Latest IT certification News 

Help You Pass Any IT Exam