TCP header

  • Port number: a quad containing the client IP address, client port number, server IP address, and server port number uniquely identifies the two parties of each TCP connection on the Internet.
  • Serial number: Serial number identifies the byte stream sent from the TCP source to the TCP receiver. It represents the first byte in the packet segment.
  • Acknowledgment sequence number: Since each byte transmitted is counted, the acknowledgment sequence number contains the next sequence number that the end that sent the acknowledgment expects to receive. Therefore, the confirmation sequence number should be the last successfully received data byte sequence number plus 1.
  • Header length: The header length gives the number of 32-bit words in the header. This value is needed because the length of the optional field is variable. This field takes up 4 bits (64 bytes), so TCP has a maximum header of 60 bytes.
  • Flag bits: There are six flag bits in the TCP header. Multiple of them can be set to 1 at the same time.
  • Window size: TCP traffic control is provided by the declared window size at each end of the connection. The window size is the number of bytes, starting with the value indicated by the confirmation ordinal field, which is the byte that the receiver expects to receive. The window size is a 16-bit field, so the maximum window size is 65535 bytes.
  • Check and: Checks and covers the entire TCP packet segment: TCP header and TCP data. This is a mandatory field that must be computed and stored by the originator and validated by the receiver.
  • Emergency pointer: The emergency pointer is a positive offset that is added to the value in the ordinal field to indicate the ordinal number of the last byte of emergency data. TCP emergency mode is a way for the sender to send emergency data to the other end.
  • Options: The most common optional field is the Maximum Segment Size (MSS). Each connector typically specifies this option in the first message segment of the communication, where the SYN flag is set for establishing the connection. It indicates the maximum length of the packet segment that can be received by the local end.