0
30kviews
Explain how TCP handles error control and flow control.
1 Answer
1
1.6kviews

Error handling in TCP

TCP includes mechanisms for detecting corrupted segments, lost segments, out-of-order segments and duplicated segments.

Error control in TCP is achieved through use of three simple techniques:

  • Checksum

  • Acknowledgement

  • Retransmission

1. Checksum

  • Each segment includes a checksum field used to check for corrupted segment.

  • TCP uses a 16-bit checksum.

  • Corrupted segment is discarded by the destination and is considered lost.

  • TCP checksum is a weak check by modern standards which uses CRC method.

2. Acknowledgement

  • TCP confirms the receipt of data segments.

  • Control segments that carry no data but consume a sequence number are also acknowledged.

  • ACK segments are never acknowledged.

3. Retransmission

  • A segment is retransmitted on two occasions:

    i. When a retransmission timer expires

    ii. When the sender receives three duplicate ACKs

  • There is no retransmission for ACK segments

  • Retransmission after RTO

    i. TCP maintains one RTO timer for all outstanding (sent, but not acknowledged) segments.

    ii. When the timer matures, the earliest outstanding segment is retransmitted.

    iii. Value of RTO is dynamic and updated based on RTT.

  • Retransmission in TCP can be Fast retransmission or Adaptive retransmission.

Flow control in TCP

TCP uses an end-to-end flow control protocol to avoid having the sender send data too fast for the TCP receiver. It uses sliding window protocol for this.

In each TCP segment, the receiver specifies in the receive window field the amount of additionally received data that it is willing to buffer for the connection.

The size of the window is determined by the lesser of two values: rwnd or cwnd

i. rwnd

It is the number of bytes the receiver can accept before its buffer overflows.

ii. cwnd

It is the value determined by the network to avoid congestion.

enter image description here

Please log in to add an answer.