TCP Segment Header

Like IP, the TCP segment header typically consists of five 32-bit words, with the potential for optional words containing additional options and the relevant padding to make 32 bits of data. Figure 3-9 depicts the TCP segment header.

Figure 3-9. TCP Segment Header Structure

[View full size image]

SOURCE PORT

DESTINATION PÛR1

SEQUENCE NUMBER

ACKNOWLEDGED ENl NUMBfjR

DATA OFFSET

RESERVED

u

A

P

R

S

R

c

S

S

V

G

K

H

T

WiNDOW

URGENT POINTER

PAQpING (Of11ICNAL)

The fields of the TCP segment header and their meanings are as follows:

• Source Port (16 bits) This field represents the source protocol or application. This allows the source to know which application the data belongs to so that responses can be delivered to the appropriate source application. In most cases, the source port is a random high-level port number (>1024) generated by the application.

• Destination Port (16 bits) This field represents the destination protocol or application on the target host. This allows the destination to properly route the data to the appropriate higher-layer application or protocol. In most cases, the destination port is a defined (and in some cases well known) port number that is associated with the protocol or application in question.

• Sequence Number (32 bits) This field contains the information necessary for the hosts to know what data has been transmitted. If the SYN control bit is enabled, this value is the initial sequence number (ISN) and the first data octet is the ISN + 1.

• Acknowledgement Number (32 bits) This field contains the value of the next sequence number the sender is expecting to receive. This field relies on the ACK control bit to be set and is always sent after a session has been established

• Data Offset (4 bits) This field indicates where the actual data begins by specifying how many 32-bit words exist in the TCP header. It is also referred to as the Header Length (HLEN) field.

• Reserved (4 bits) This field is reserved for future use and must have a value of 0.

• Explicit Congestion Notification (ECN, 2 bits) This field is used, like in IP, for ECN information. The first bit is used to set the Congestion Window Reduced (CWR) flag; the second bit sets the ECN-echo (ECE) flag.

• Control bits (6 bits from left to right) The control bits tell the hosts what they should be doing with the session. There are 6 bits that can be either on (1) or off (0) and from left to right they are as follows:

- URG This indicates that the Urgent Pointer field is significant.

- ACK This indicates that the Acknowledgment field is significant.

- PSH This indicates that the push function is requested.

- RST This indicates that the connection should be reset.

- SYN This indicates that the sequence numbers should be synchronized.

- FIN This indicates that there is no more data from the sender and the session can be terminated.

• Window (16 bits) This field represents the number of data octets that will be transmitted before an ACK is expected.

• Checksum (16 bits) This field verifies that the data received is the proper size as what was transmitted.

• Urgent Pointer (16 bits) This field is only processed in segments where the URG control bit is set and communicates the value of the urgent pointer as a positive offset from the sequence number of the current segment.

• Options (variable) The Options field contains any number of variable option values that must be understood by all TCP hosts, but in practice are rarely used.

• Padding (variable) This field provides the necessary padding to the Options field to ensure that the data length is 32 bits.

Continue reading here: Bad TCP

Was this article helpful?

0 0

Readers' Questions

  • donnamira
    What is a range of tcp segment header?
    7 months ago
  • A TCP segment header contains a total of 20 bytes divided into 10 fields. The fields are: Source Port, Destination Port, Sequence Number, Acknowledgement Number, Data offset, Reserved, Control Bits, Window, Checksum, Urgent Pointer, and Options.
    • tom
      Why are port numbers included in the tcp header of a segment?
      8 months ago
    • Port numbers are included in the TCP header of a segment to help the network identify the intended source and destination of the TCP segment. The port numbers allow the host to differentiate between multiple applications that are using the same IP address. By including the port numbers in the TCP header, the TCP segment is directed to the correct application process on the receiver's side.