🧭

TCP Basics Overview

Nov 5, 2025

Overview

TCP segments are fundamental units of transport-layer communication that must be analyzed when troubleshooting network traffic issues. Understanding TCP segment structure enables IT professionals to diagnose connection problems effectively.

TCP Encapsulation Model

  • Ethernet frames encapsulate IP datagrams within their payload section.
  • IP datagrams encapsulate TCP segments within their payload section.
  • TCP segments consist of a TCP header and a data payload section.
  • The data section contains application-layer information passed down from higher protocol layers.

TCP Header Structure

The TCP header contains multiple fields that manage connection establishment, data sequencing, and flow control. Each field serves a specific purpose in ensuring reliable data transmission.

FieldSizePurpose
Source Port16 bitsHigh-numbered ephemeral port identifying the sending application
Destination Port16 bitsPort number of the target service receiving the traffic
Sequence Number32 bitsTracks position of this segment within the complete data stream
Acknowledgment Number32 bitsIndicates the next expected segment number from sender
Data Offset4 bitsSpecifies TCP header length so receiver knows where payload begins
Control Flags6 bitsReserved space for six TCP control flags
TCP Window16 bitsDefines range of sequence numbers sendable before requiring acknowledgment
Checksum16 bitsValidates data integrity across the entire segment
Urgent Pointer16 bitsPoints to important segments; rarely used in modern networks
OptionsVariableSupports complex flow control; rarely implemented in practice
PaddingVariableSequence of zeros ensuring payload begins at expected location

Port Management

  • Source ports are selected from the ephemeral port range for outbound connections.
  • Multiple simultaneous connections remain separate through unique source port assignments.
  • Destination ports direct traffic to specific services running on target systems.
  • Source ports enable return traffic to reach the correct requesting application.
  • This mechanism ensures web server responses reach browsers instead of unrelated programs.

Sequence and Acknowledgment System

  • TCP uses sequence numbers because Ethernet frames limit transmission to 1518 bytes typically.
  • Large data transfers require splitting into multiple segments at the transport layer.
  • Sequence numbers track which segment position this particular packet represents.
  • Acknowledgment numbers indicate which segment the receiver expects next in sequence.
  • Example: Sequence number 1 with acknowledgment 2 means "this is segment 1, send segment 2 next."

Flow Control and Reliability

  • TCP relies heavily on acknowledgments to confirm successful data reception.
  • The TCP window specifies how many segments can be sent before requiring acknowledgment.
  • This prevents sending devices from transmitting data that receivers cannot process.
  • Checksums validate that no data corruption or loss occurred during transmission.
  • The checksum calculation covers the entire segment and matches against the header value.