TCP Lecture Notes

Motivation for TCP

  • TCP (Transmission Control Protocol) is a process-to-process protocol, utilizing port numbers for end-to-end communication.

  • It ensures reliability by retransmitting lost packets and delivering data in order, eliminating duplicates.

  • Reliability is achieved through connection establishment and teardown, byte numbering for sequence tracking, acknowledgments, and retransmissions.

  • TCP implements flow control to prevent receiver buffer overflow and congestion control to adapt to network congestion.

TCP Header Format

  • (This section will likely be covered in more detail later in the lecture.)

TCP Life Cycle

  • Connection Setup: Establishing a TCP connection between two hosts.

  • Data Transaction: Transferring data between the connected hosts.

  • Connection Teardown: Terminating the TCP connection.

TCP Flow Control

  • (This section will likely be covered in more detail later in the lecture.)

Transmission Control Protocol (TCP)

  • Process-to-process (end-to-end) communication using port numbers.

  • Reliability:

    • Lost packets are retransmitted by the source.

    • In-order delivery is guaranteed.

    • Duplicate packets are eliminated.

  • Methods to achieve reliability:

    • Connection-oriented: TCP connection setup and teardown.

    • Stream of bytes: Bytes are numbered with a sequence number for each byte.

    • Sequence numbers are used to detect losses, duplicates, and data reordering.

    • Acknowledgments & retransmissions ensure reliable delivery.

  • Flow control:

    • Prevents overflow of the receiver’s buffer.

  • Congestion control:

    • Adapts to network congestion for the greater good of the network.

Does TCP Duplicate Lower Layer Services?

  • TCP uses a sliding-window based algorithm.

    • Incorporates ACK (acknowledgment), NACKs (negative acknowledgments), retransmissions, timeouts, and ordering.

  • How TCP is different from lower layer services:

    • Runs over a route rather than a single physical link.

    • Needs to establish a connection and negotiate parameters (e.g., sliding window size).

    • Adapts to heterogeneous conditions.

      • Round-Trip Time (RTT) varies with connected hosts, time of day, etc., and is unpredictable.

    • Provides flow control on computers with different resources.

    • Reorders and retransmits packets end-to-end.

      • Even if packets are in order on one physical link, this does not guarantee end-to-end ordering.

    • Provides congestion control.

      • No immediate feedback from the link, and no knowledge of conditions along the way.

      • Congestion control is based on feedback.

Stream of Bytes and Sequence Numbers

  • Host A (source) sends data to Host B (destination).

  • TCP Header (HDR) includes:

    • ISN (Initial Sequence Number): The starting sequence number for the connection.

    • Sequence number of the 1st byte: The sequence number of the first byte in the current segment.

    • ACK sequence number = next expected byte: The acknowledgment number indicates the next sequence number the receiver expects to receive.