What is the basic idea behind TCP reliable data transfer?

Transmission Control Protocol

Transmission Control Protocol (TCP) is a transport layer protocol that connects applications so that they can exchange data over a communication network. On top of an unreliable (IP) network layer, TCP is a reliable data transport protocol.

Note: Want to read more about TCP? Refer here.

Reliability during data transfer

To achieve reliable data transfer, TCP must recover data from the internet that has been corrupted, lost, duplicated, or transmitted out of order. TCP accomplishes this reliability by allocating a sequence numberUsed to sequentially number data packets as they transit from sender to receiver. The receiver can identify a lost packet by analyzing the gaps in the sequence numbers of received packets. to each byte it sends. Next, it requests an affirmative acknowledgment (ACK) from the receiving side.

Corrupt packets are managed by appending a checksumIt helps in detecting bit errors while transmitting the data packet. to each broadcast segment, verifying it at the receiver, and dropping corrupted segments.

The following two special cases involved in reliable data transfer are discussed:

  • Lost packet

  • Lost acknowledgment

Lost packet

The data is transmitted again if the ACK is not received in the allotted period. TCP retransmission time-out value is dynamically chosen based on round-trip timeThe round-trip time (RTT) is the time duration when a browser submits a request and receives a response back from the server.. Sequence numbers are utilized at the receiver to remove duplicate segments and to accurately organize any segments that might have been received out of order.

Example

To understand this concept, let's consider the following illustrations:

Packets 1 and 2 are sent and acknowledged successfully.
1 of 5

The illustration above will play out as follows:

During data transmission, TCP packet 3 gets lost.

  • This is because the sender did not get ACK 3, therefore the window remained in position 2.

  • The receiver did not receive packet 3, therefore it will acknowledge packets four and five with an ACK 2.

  • Packet 3 will time out, be retransmitted, and the receiver will issue ACK 5.

  • After successfully receiving packets 1 through 5, the sender's window will move three positions.

Lost acknowledgment

The packet did arrive, but the acknowledgment got lost. In this scenario, TCP utilizes the concept of cumulative acknowledgmentThe receiver sends a single acknowledgment in response to a certain number of frames received by cumulative acknowledgment. to provide reliable data transmission.

Example

Consider the following demonstrations that thoroughly explain the aforementioned concept:

Packets 1 and 2 are received by the receiver.
1 of 4

These illustrations portray that packet 3 did arrive but its acknowledgment was lost.

  • Although the sender does not receive ACK 3 but does receive ACK 4.

  • ACK 4 acts as cumulative acknowledgment for all packets up to packet 4 (including packet 3).

  • The sender can now move the window to packet 5.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved