What is the TCP Segment Header?


Every TCP segment consists of a 20 byte fixed format header. Header options may follow the fixed header. With a header so that it can tag up to 65535 data bytes.

The TCP header format is shown in the figure below −

Source Port

It is a 16-bit source port number used by the receiver to reply.

Destination Port

It is a 16-bit destination port number.

Sequence Number

The sequence number of the first data byte in this segment. During the SYN Control bit is set, and the sequence number is n, and the first data byte is n + 1.

Acknowledgement Number

If the ACK control bit is set, this field contains the next number that the receiver expects to receive.

Data Offset

The several 32-bit words in the TCP header shows from where the user data begins.

Reserved (6 bit)

It is reserved for future use.

URG

It indicates an urgent pointer field that data type is urgent or not.

ACK

It indicates that the acknowledgement field in a segment is significant, as discussed early.

PUSH

The PUSH flag is set or reset according to a data type that is sent immediately or not.

RST
 
It Resets the connection.

SYN

It synchronizes the sequence number.

FIN

This indicates no more data from the sender.

Window

It is used in Acknowledgement segment. It specifies the number of data bytes, beginning with the one indicated in the acknowledgement number field that the receiver is ready to accept.

Checksum

It is used for error detection.

Options

The IP datagram options provide additional punctuality. It can use several optional parameters between a TCP sender and receiver. It depends on the options used. The length of the field may vary in size, but it can't be larger than 40 bytes due to the header field's size, which is 4 bit.

The most typical option is the maximum segment size MASS option. A TCP receiver communicates to the TCP sender the total length of the segment it can accept with this option. The other various options are used for flow control and congestion control, each explained in the table shown in the table.

Table of Options

The table of options in TCP segment header is as follows −

Kind
Length
Meaning
                       0
                        -
         End of option list
                       1
                        -
         No operation
                       2
                        4
  Maximum segment size
                       3
                        3
         Window Scale
                       4
                        2
          Sack-permitted
                       5
                       X
            Sack
                       8
                      10
            Time Stamps

Padding

Options in each may vary in size, and it may be necessary to "pad" the TCP header with zeros so that the segment ends on a 32-bit word boundary as per the standard.

Data

Although in some cases like acknowledgement segments with no data in the reverse direction, the variable-length field carries the application data from sender to receiver. This field, connected with the TCP header fields, constitute a TCP segment.

Updated on: 05-May-2021

23K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements