TCP Header | L4 Header
TCP is the layer 4-Transport layer protocol and when data is received in Transport layer as PDU DATA from Sessionn layer it adds Header on the
data according to the service i.e TCP or UDP. When header is added the PDU is called Segment. Below is the Header added at this layer and task of
The size of TCP header is Minimum 20 byte Maximum 24 bytes.
A port is an endpoint to a logical connection and the way a client program specifies a specific server program on a computer in a
network. The port number identifies what type of port it is.Specific Destination ports are reserved ans source port are random for protocol.
Example: Destination Port number of FTP is 80, but for some protocol source and destionation protocol are reserved for example DHCP, source
port is 68 and destination port is 67.
Sequence number is a 32-bit wide field identifies the first byte of data in the data area of the TCP segment. We can identify every byte
in a data stream by a sequence number.
Acknowledge number is also a 32-bit wide field which identifies the next byte of data that the connection expects to receive from the data stream.
Header length is a field which consists of 4 bit to specifies the length of the TCP header in 32-bit words. Receiving TCP module can calculate the
start of the data area by examining the header length field.
Reserved for future purpose.
There are 6 flags in TCP header.
URGENT – URG flag tells the receiving TCP module as it is urgent data
ACKNOLEDGMENT – ACK tells the receiving TCP module that the acknowledge number field contains a valid acknowledgement number
PUSH – PSH flag tells the receiving TCP module to immediately send data to the destination application
RESET – RST flag asks the receiving TCP module to reset the TCP connection
SYNCHRONIZATION – SYN flag tells the receiving TCP module to synchronize sequence number
FINISH – FIN flag tells the receiving TCP module that the sender has finished sending data
Window size field is a 16-bit wide which tells the receiving TCP module the number of bytes that the sending end id willing to accept.
The value in this field specifies the width of the sliding window.
TCP checksum is a 16-bit wide filed includes the TCP data in it’s calculations. This field helps the receiving
TCP module to detect data corruption. That is, TCP requires the sending TCP module to calculate and include checksums in
this field and receiving TCP module to verify checksums when they receive data. The data corruption is detected in this way.
Urgent pointer is a 16-bit wide field specifies a byte location in the TCP data area. It points to the last byte of urgent data in the TCP data area.