TCP Header Format
TCP Segments are preceeded by a minimum 24-byte header that is used to establish and track the communication between two TCP endpoints. TCP does not need to keep track of which systems are communicating, it only needs to track which connections are currently open. Internet Protocol handles the host-to-host connectivity.
TCP uses port numbers on each side of the connection to track the connection endpoints and sequence numbers to track the communication at each step in transmission.
An example of a TCP header is shown below.
| Source Port (0 - 65535) |
Destination Port |
||||||||
| Sequence Number (0 - 4294967295) |
|||||||||
| Acknowledgement Number (0 - 4294967295) |
|||||||||
| Data Offset |
Reserved | U R G |
A C K |
P S H |
R S T |
S Y N |
F I N |
Window | |
| Checksum (CRC-Check) |
Urgent Pointer | ||||||||
| Options | Padding | ||||||||
| Data | |||||||||
| Field | Size | Usage |
| Source Port | 16 bits | Communication source point |
| Destination Port | 16 bits | Communication end point |
| Sequence Number | 32 bits | Used for segmentation and reassembly of TCP segments. |
| Data Offset | ||
| Reserved | ||
| URG - Urgent Flag | 1 bit | |
| ACK - Acknowledgement Flag | 1 bit | |
| PSH - Push Flag | 1 bit | |
| RST - Reset Flag | 1 bit | |
| SYN - Synchronize Flag | 1 bit | |
| FIN - End of data | 1 bit | |
| Window | 16 bits | Number of data octets in the TCP header |
| Checksum | 16 bits | |
| Urgent Pointer | 16 bits | |
| Options | Varies | |
| Padding | Varies |