TCP Header Explanation
TCP Header Explanation
Introduction
TCP (Transmission Control Protocol) is a connection-oriented, reliable protocol in the Transport Layer of the
OSI and TCP/IP models. It ensures error-free, in-order delivery of data between systems. Each TCP segment
contains a TCP header which carries crucial information for managing TCP communication.
0 4 8 12 16 20 24 28 32 bits
-----------------------------------------------------------------------------------------------
|---------------------------------------------------------------------------------------------|
|---------------------------------------------------------------------------------------------|
|---------------------------------------------------------------------------------------------|
|---------------------------------------------------------------------------------------------|
|---------------------------------------------------------------------------------------------|
Identifies the port number of the sender application (e.g., port 80 for HTTP).
Used for data ordering. It specifies the number of the first byte of data in the segment.
Specifies the next byte expected by the receiver, enabling reliable delivery.
TCP Header and Its Fields
Indicates the size of the TCP header (in 32-bit words). Minimum is 5 (i.e., 20 bytes).
Reserved (3 bits):
URG: Urgent pointer valid | ACK: Acknowledgment valid | PSH: Push data
Specifies the number of bytes the sender is willing to receive (flow control).
Valid only if URG flag is set. Points to the last urgent byte in the segment.
Padding (Variable):
Conclusion
The TCP header plays a vital role in ensuring reliable communication between sender and receiver. Its
well-structured fields support sequencing, flow control, error detection, and proper connection