Just like how an Ethernet Frame encapsulates an IP Datagram, an IP Datagram encapsulates a TCP segment. We have discussed in previous article that Ethernet Frame has a payload section which is really just the entire contents of an IP Datagram. We have also discussed that IP Datagram has a payload section which is nothing but a TCP_Segment.Here in this article we will discuss about the dissection of TCP_Segment.
The TCP_ Segment made up of a TCP header and a Data section. The data section is like another payload area where Application layer places its data. A TCP Header consists of lots of fields containing lots of information.
The Destination Port
Destination port is the port number of a service to which traffic is intended for. A port is a 16 bit number that directs traffic to specific services running on networked devices. The Transport Layer handle multiplexing and demultiplexing through ports.
A high-numbered port which is from a special section of ports refers to as ephemeral ports. The source port is important to keep lots of outgoing connection separate.
It is a 32 bit Number that keep tracking of exact location of a TCP Segment in a sequence of TCP segments. We have discussed previously that lower on our protocol stack, there limits to the total size of what we send across the wire. In Ethernet Frame, it is usually limited in size to 1518 bytes. But we usually need to send way more data than that. Therefore at transport layer TCP splits all of this data up into many segments. So the Sequence number in header is necessary to keep track of the right sequence of a particular segment out of many.
Acknowledgement number in TCP header is similar to Sequence Number. This is the number of next expected TCP Segment. For Example, a sequence number of 1 and an acknowledgement number of 2 refers to as this is segment 1, expect segment 2. The Data offset field comes next.
Data Offset Field | Header Length
This a 4 bit number that represents how long TCP header for this segment is. This is how receiving network device understands where the actual data payload begins.
TCP Control Flag
The are total six flags in TCP header. In the article next we will discuss the TCP flag in more details. But for now we will just mention the name of these six TCP flags. They are URG (Urgent), ACK (Acknowledged), PSH Push), RST (Reset), SYN (Synchronize), and finally FIN (Finish) flag.
TCP Window is 16 bit number that specifies the range of sequence number. This might be sent before an acknowledgement is required. Because TCP is a protocol that is extremely reliant on acknowledgements. So TCP Window is important to make sure that the receiving device actually has received all expected data. Also because, the sending device doesn’t waste time sending data that the receiving device isn’t receiving.
It operates similar to checksum field at IP and Ethernet level. So the checksum compared with checksum in TCP header after delivering entire TCP segment to make sure data integrity along the way.
The urgent pointer field is necessary in conjunction with one of the TCP control flags. Because it indicates the particular segments that might be more important than others. But this feature is obsolete in modern networking. Even so it is important to know what all sections of TCP header are.
Like the Urgent field real life application of options field is also rear. But sometimes it is necessary for more complicated flow control protocols.
Finally the padding field which is nothing but a sequence of zeros.It ensures that the data payload section begins at the expected location.