TCP header
The segment consists of a 20 to 60-byte header, followed by data from the application program. The TCP header is 20 bytes if there are no options and up to 60 bytes if it contains options.
1. Source port: A 16-bit number identifying the application that TOP segment originated from within the sending host.
2. Destination port: A 16-bit number identifying the application that TOP segment is destined for on a receiving host.
3. Sequence Number: A 32-bit number identifying the current position of the first data byte in the segment within the entire byte stream for the TCP connection.
4. Acknowledgment Number: A 32-bit number identifying the next data byte that the sender expects from the receiver.
5. Header length: This 4-bit field indicates the number of 4-byte words in the TCP header. The length of the header can be between 20 and 60 bytes.
6. Reserved: This is a 6-bit field reserve for future use.
7. Control: This field defines six different control bits or flags. One or more of these bits can be set at a time.
i. URG: The value of the urgent pointer field is valid.
ii. ACK: The value of the acknowledgment field is valid.
iii. PSG: Push the data.
iv. RST: Reset the data,
v. SYN: Synchronize the sequence numbers during connection.
vi. FIN: Terminate the connection.
8. Window size: This field defines the size of the window (in bytes), The length of this field is 16-bits.
9. Checksum: This 16-bit field contains the checksum for error control-It is mandatory in TCP as opposed to UDP.
10. Urgent pointer: This 16-bit field, which is valid only if the urgent flag is set, is used when the segment contains urgent data.
11. Options: There can be up to 40-bytes of optional information in the TCP header
Working of TCP protocol:
- TCP/1P Divides communication tasks into layers that keep the process standardized.
- The data packets pass through lour layers before they are received by the destination device, then P/IP goes through the layers in revere order to put the message back into its original ‘format.
- TCP establishes and maintains a connection between applications or devices until they finish exchanging data.
- It determines how the original message should be broken into packets. The numbers and reassembles the packets, and sends them on to their destination.
- TCP also sends and receives packets from the network layer, handles the transmission of any dropped packets, manages flow control, and ensures all packets reach their destination.
- TCP/IP uses a three-way handshake to establish a connection between a device and a server.
Read more about Digital Encoding