Summary

TCP

reliable, byte stream-oriented transport protocol

  • server process must first be running
  • server created socket for client
  • client create socket to IP address, port number -

Multiplexing

  • demultiplexing using 4-tuple:
    • source IP
    • source port
    • destination IP
    • destination port

Connection

Open

TCP 3-way handshake

  1. Initiating client requests a client-to-server: client send SYN
  2. The server acknowledges and requests a server-to-client: server send SYN, ACK
  3. The initiating client acknowledges the server to client: client send ACK

Closing a TCP connection

  • client/server each close their side of connection by send TCP segment with FIN bit = 1
  • respond to received FIN with FIN, ACK
  • TCP connection is closed when both sides have received ACK for their FIN

Socket

TCP Server

TCP client

Fast Retransmit

  • Receiver sends duplicate ACKs if it receives out-of-order segments (indicating a segment may
  • Sender retransmits a segment if it receives 3 ACKs for the same data (duplicate ACKs)

Flow Control

  • If network layer delivers data faster than application layer can read, receiver’s buffer may overflow
  • TCP uses flow control to prevent overflow: sender limits amount of data in transit
  • Receiver advertises available buffer space (receiver window) to sender in rwnd (receive window) field in TCP header
  • sender limits amount of unACKed dita to received rwnd

End-end congestion control

  • no explicit feedback from network
  • congestion inferred from observed loss/delay
  • used in TCP
  • TCP sender limits
  • is dynamically adjusted based on perceived congestion level

AIMD

Note

Additive Increase: increase sending rate by 1 maximum segment **Multiplicative Decrease:**cut sending rate in half at each loss event

  • Senders can increase sending rate until packet loss occurs, then decrease sending rate on loss event.

Slow Start

when connection begins, increase rate exponentially until first loss event

Back to linear scale

Switch back to linear when cwnd gets to half of its value before timeout (determined by ssthresh slow start threshold)

React to Loss

Note

  • TCP Tahoe = Loss via Timeout
  • TCP Reno = Loss via Triple Duplicate ACK

  • When loss detected by triple duplicate ACK (TCP Reno)
  • When loss detected by tiemout (TCP tahoe)
    • cwnd is cut to 1 MSS (Maximum segment size— the size of largest segment TCP can send)
    • enter TCP Slow Start

TCP CUBIC

  • to probe for usable bandwidth

  • : sending rate at which congestion loss was detected

  • the larger the , the more aggressive the increase in sending rate

  • is the time when

    • Concave Growth (Before K): When the current time is far from K, the window increases rapidly to regain lost throughput. As the time approaches K, the increments become smaller and more cautious to avoid overshooting network capacity.
    • Convex Probing (After K): Once the time surpasses K, the function flips, and the window begins to grow more aggressively again to “probe” for new available bandwidth.

Delay-based TCP congestion control

  • : minimum observed RTT (uncongested path)
  • uncongested throughput with congestion window cwnd is
  • if measured throughput close to uncongested throughput:
    • increase cwnd linearly
  • if measured throughput significantly less than uncongested throughput:
    • decrease cwnd linearly
Link to original