🧩

TCP Segment Structure Overview

Jul 14, 2025

Overview

This lecture breaks down the structure of a TCP segment, detailing its header fields and explaining how TCP ensures reliable data transport across networks.

TCP Segment Structure

  • A TCP segment consists of a TCP header and a data section (payload).
  • The data section carries application layer data as the payload.
  • TCP segments are encapsulated inside IP datagrams, which are then encapsulated in Ethernet frames.

TCP Header Fields

  • Source and destination port fields identify the sending and receiving applications.
  • The source port is typically chosen from ephemeral ports, used to track multiple simultaneous connections.
  • The destination port ensures data reaches the intended service (e.g., web server on port 80).
  • Sequence number (32-bit) tracks the position of a segment in a sequence of transmitted data.
  • Acknowledgement number indicates the next expected sequence number from the sender.
  • Data offset (4-bit) specifies where the TCP header ends and the payload begins.
  • TCP control flags (6 bits) manage connection state and control flow.
  • TCP window (16-bit) specifies the range of bytes that can be sent before an acknowledgment is needed.
  • Checksum (16-bit) verifies data integrity by comparing checksums at sender and receiver.
  • Urgent pointer identifies important segments when used with a control flag (rarely used).
  • Options field provides support for advanced TCP features (rarely used).
  • Padding ensures the payload starts at the correct offset.

Key Terms & Definitions

  • TCP Segment — Data package at the transport layer, consisting of a header and payload.
  • Ephemeral Port — Temporary high-numbered port used for outbound connections.
  • Sequence Number — Number indicating a segment’s order in a stream.
  • Acknowledgement Number — The number of the next segment expected by the receiver.
  • TCP Window — Range of allowed, unacknowledged bytes in transmission.
  • Checksum — Value used to detect errors in transmitted data.

Action Items / Next Steps

  • Review the functions of each TCP header field.
  • Prepare to discuss how TCP ensures reliable data delivery in the next session.