Reliability is one of the key features of TCP. TCP uses a combination of sequence numbers and acknowledgements to ensure all requested data has been received. However, the process of retransmitting segments that do not arrive at their destination can lead to certain inefficiencies. This is illustrated in the figure where a client receives data from a server. Again, for simplicity, segment numbers are used instead of bytes.

TCP Reliability using Acknowledgments

Step 1. As part of a larger data stream, the server sends the first five TCP segments to the client. However, Segment 2 is lost and never arrives at the client.

Step 2. The client receives Segment 1, but has not yet received Segment 2. The client sends Acknowledgement 2 to the server, indicating Segment 1 was received and Segment 2 is still expected.

Step 3. The next segments received by the client are Segment 3, Segment 4, and Segment 5. Because the client is still expecting Segment 2, it sends duplicate Acknowledgement 2s back to the server, one for each successive segment it received.

Step 4. The server receives the multiple Acknowledgement 2s from the client. The server must resend Segment 2. This is where the inefficiency happens. The server has no indication whether Segments 3 through 5 arrived at the client. The server must not only resend the lost segment, Segment 2, but also Segments 3 to 5.

Step 5. The client receives the missing segment, Segment 2 along with duplicate segments, Segments 3 to 5. The client sends an acknowledgement for each of the segments.

Step 6. The server receives the acknowledgments from the client and sends the next segment in its transmission queue, Segment 6.