Header format for TCP (Transmission Control Protocol)

Headers: Headers are variously used in different fields of Computers. These are control information that is attached to data which guides it and makes it error free, reach destination reliably and make the data travel faster etc.

In Computer Networking IP datagrams also known as Packets. These IP datagrams composed of two parts the Header and payload (data), it is just like html page the header and the body respectively. Every protocol follows a different header format for its data to be transmit and received reliably.

Header format for TCP: Header format for TCP is shown below:

TCP Header Format

TCP Header Format

  • Source Port: It is 16 bits in length and defines port of the source TCP user. Like HTTP has 80 port number.
  • Destination Port: It is also 16 bits in length and tells the port of the destination TCP user.
  • Sequence Number: A 32 bit number which tells the sequence of the data in terms of octets. Contains the sequence number of the first data octet.
  • Acknowledgment Number: Contains the sequence number of the next data octet. It is also 32 bit
  • Data Offset: Tells the quantity of 32 bit words in the header. It is 4 bits in length.
  • Reserved: 4 bit number reserved for future use.
  • Flags: These are 8 bits in length and have different meaning and control information. e.g. RST reset the connection.
  • Window: It is 16 bits long and contains the number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
  • Checksum: Use for error detection by using one’s complement. It is 16 bits in length
  • Urgent Pointer: The urgent pointer points to the sequence number of the octet following the urgent data. It is 16 bits in length.