TCP

Feature

  1. Connected-Oriented: Establish connection before starting communication between end system
  2. Reliability
    • Destination send confirmation packets after receiving packets from source
    • TCP labels the packets so they can be read in order
  3. Flow Control: Adjust transmission rate to avoid packet loss

Methods

Acknowledgement

  • Every time the server receives a packet, it will send a ACK packet which contain the highest sequence number which is received correctly
  • If client receives ACK packet with the same sequence number again and again, then we know that packet loss has happened

Sequence Number

  • Give each packet of the same connection successive sequence number
  • We can reorder the packets on the server based on sequence number
  • Server can notice packet loss if it can’t receive packet with certain sequence number

Retransmission

  • If an ACK with the expected sequence number isn’t received within the timeout period after sending a packet, the packet is considered lost and retransmitted
  • Accurate RTT estimation is critical: timeouts that are too short cause unnecessary retransmissions, while timeouts that are too long reduce throughput

Pipeline Transmission

  • We let packets in flight with waiting for ACK
  • If we need to wait for every packet’s ACK come back until next packet is sent, then the throughput is wasted

Flow Control

  • Transmitter makes sure the destination’s buffer isn’t filled up, this prevents packet loss

Congestion Control

Case 1: Timeout

This means we doesn’t receive ACK for a long time, there might be some severe problem in the path. Hence, we reset transmission speed

Case 2: Duplicate ACKs

This means that some packet with ACK’s sequence number + 1 is lost. Hence, we cut transmission speed to half