What is inside a TCP segment?

Posted: (EET/GMT+2)

 

Applications can exchange data over TCP by sending units of information called segments. Each TCP segment contains a header followed by the actual data.

A simplified TCP header contains the following fields:

  • Source Port
  • Destination Port
  • Sequence Number
  • Acknowledgement Number
  • Flags
  • Window Size
  • Checksum.

The source and destination ports identify the communicating applications. The sequence number allows the receiving computer to place incoming data in the correct order.

The acknowledgement number confirms that previously received data arrived successfully.

The flags control the state of the connection. Common flags include:

  • SYN: Start a connection
  • ACK: Acknowledge data
  • FIN: Close a connection
  • RST: Reset a connection.

The window size tells the sender how much additional data may be transmitted before waiting for further acknowledgements. Finally, the checksum helps detect transmission errors.

Together, these fields allow TCP to provide reliable, ordered communication over IP networks.

For more information, see RFC 793. Happy networking!