What is the TCP Segment Header?

The TCP segment header is a fixed 20-byte structure that contains essential control information for reliable data transmission between network endpoints. Every TCP segment begins with this header, which may be followed by optional fields and data payload.

TCP Segment Header Format (20 bytes) 0 16 32 Source Port (16 bits) Destination Port (16 bits) Sequence Number (32 bits) Acknowledgment Number (32 bits) Data Offset Reserved Control Flags (URG ACK PSH RST SYN FIN) Window Size Checksum (16 bits) Urgent Pointer (16 bits) Options and Padding (Variable) DATA PAYLOAD Fixed header: 20 bytes minimum

TCP Header Fields

Source Port

A 16-bit field that identifies the sending application or service. The receiver uses this port number to send reply messages back to the correct application.

Destination Port

A 16-bit field specifying the target application or service on the receiving host.

Sequence Number

A 32-bit field containing the sequence number of the first data byte in this segment. During connection establishment when the SYN flag is set, this field contains the initial sequence number.

Acknowledgment Number

A 32-bit field that, when the ACK flag is set, contains the next sequence number that the receiver expects to receive.

Data Offset

A 4-bit field indicating the number of 32-bit words in the TCP header, specifying where the data portion begins.

Reserved

A 6-bit field reserved for future use and must be set to zero.

Control Flags

Six 1-bit flags that control the TCP connection:

  • URG − Indicates that the urgent pointer field is significant

  • ACK − Indicates that the acknowledgment field is valid

  • PSH − Requests immediate delivery of data to the application

  • RST − Resets the connection due to an error

  • SYN − Synchronizes sequence numbers during connection establishment

  • FIN − Indicates no more data from the sender

Window Size

A 16-bit field specifying the number of bytes the receiver is willing to accept, used for flow control.

Checksum

A 16-bit field used for error detection, covering both the header and data portions of the segment.

Urgent Pointer

A 16-bit field that points to urgent data when the URG flag is set.

TCP Options

The TCP header can include optional fields that provide additional functionality. The most common option is the Maximum Segment Size (MSS), which negotiates the largest segment size both endpoints can handle.

Kind Length Purpose
0 - End of option list
1 - No operation (padding)
2 4 Maximum segment size
3 3 Window scale factor
4 2 Selective acknowledgment permitted
8 10 Timestamp option

Padding

Since options vary in size, padding with zeros ensures the header ends on a 32-bit boundary as required by the TCP specification.

Conclusion

The TCP segment header provides essential control information for reliable data transmission, including sequence numbers, acknowledgments, and flow control. Its fixed 20-byte format, combined with optional fields, enables TCP's robust connection management and error recovery capabilities.

Updated on: 2026-03-16T23:36:12+05:30

39K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements