Structure of TCP/UDP header

Structure of the TCP header

 To understand TCP communication, it is necessary to understand what is contained in the TCP header. TCP establishes a connection prior to communication, and performs acknowledgment and flow control, so the TCP header structure is much more complicated than the UDP packet structure. A typical TCP header size is 20 bytes large.

fieldexplanation
Source port number
(16 bits)
A number that identifies the sending application.
Unlike UDP, TCP cannot have a source port number of 0.
Available from 1 to 65535.
Destination port number
(16 bits)
A number that identifies the destination application.
Available from 1 to 65535.
*0 is reserved
Sequence number
(32 bits)
Number for ordering data to be sent.
Increment the sequence number by 1 for each byte of data sent.
2 If it exceeds 32 , repeat the same number again.
Acknowledgment number
(32 bits)
A field that indicates how much of the received data has been received by byte position.
Returns the sequence number + 1 of the received data position.
The ACK number field is valid only when the ACK flag is ON.
Header length
(4 bits)
A fie