TCP | Transmission Control Protocol – Explained in detail – 2023

tcp-protocol-with-header

TCP stands for Transmission Control Protocol. It is a Transport layer protocol of the OSI Model. The protocol number of TCP is 6. It is commonly used in different applications. In this article, we will discuss many features of TCP.

transmission-control-protocol

TCP is a connection-oriented protocol, which means a connection is established between the sender and receiver before they start sending or receiving data. This connection process is known as the “Three Way Handshake” process. The data from the Application Layer will first come to the Transport Layer, where either TCP or UDP will be used. Now, TCP will add its header to this data, and form a segment. This segment is now delivered to Network Layer and the IP protocol will also encapsulate an IP header to form a packet. Thus, more commonly, it is known as the TCP/IP stack.

Every time, when there is some transmission of data from the sender and receiver, the destination each time sends an acknowledgment message. This means, that after the successfully received data by the recipient, the next data packet will be delivered. If there is some error during the transmission of data, then the complete data packet is discarded by the recipient and the recipient will request to send this data packet again. Thus, TCP is a reliable protocol that has the feature of error checking and correction.

The header of Transmission Control Protocol (TCP)

As we already discussed, the data from the application layer is always forwarded to the TCP protocol. TCP divides this data into various chunks, and then TCP will add a Header to this data. After adding the TCP Header, the data will be sent to the Network layer. Below is an overview of a TCP header.

tcp-header-explained-in-details

>> Click Here for a Large Image

TCP Header all fields

  • Source Port: A source port is a 16-bit number that Identifies the sending port.
  • Destination Port: The destination port is also a 16-bit number that Identifies the receiving port.
  • Sequence Number: Sequence Number is a 32 bits random number i.e. A, which is sent when the data stream is sent to the receiving end.
  • Acknowledgment Number: An acknowledgment number is also a 32-bit number, which is always an incrementing number of Sequence Number i.e. A+1.
  • Data offset: It is a 4-bit value that specifies the total size of the TCP header. It is also used to make sure that the TCP header is within the range of 32 words.
  • Reserved: Reserved is a 3-bit number that is used for future usage. These bits are always set to Zero “0”.
  • Flags: Flags are a 9-bit field, which contains 9 1-bit flags. Each flag has a specific function. They are used for data transmission, connection establishment, and connection termination.
    • NS
    • CWR
    • ECE
    • URG
    • ACK
    • PSH
    • RST
    • SYN
    • FIN
  • Window size: Window Size is a 16-bit field, which specifies the size of receiving the data stream.
  •  Checksum: Checksum is a 16-bit field, which is used for checking and correction purposes. If there is some error in the TCP header, the checksum field is responsible for error correction.
  • Urgent pointer: It is a 16-bit number, used when the URG flag is set.
  • Options: Option is a variable-length field used for different purposes.
  • Padding: Padding is composed of zeros. It is used to determine that the TCP header ends, and all data have in the range of 32 boundaries.

Connection establishment and termination in Transmission Control Protocol (TCP)

As we discussed at the start of this article, before transmission, TCP first establishes a connection between the sender and receiver. This process is known as the Three-Way Handshake. First, a client tries to connect with a server, then the server first, opens a port on which it can listen from the client, and bind a connection with the client. This connection is known as a passive connection. In this process, a three-way (3-step process) is used, which is commonly known as Three-way Handshake. The client and server follow the following steps to establish a connection :

  • SYN: SYN stands for Synchronization. At the start, the client sends an SYN flag to the server, this indicates that a client wants to establish a connection with the server. The sequence number of this data stream or data packet is a random value A.
  • SYN+ACK: Server will receive this SYN message from a client that has a sequence number A and reply to an acknowledgment message to the client with an incremental sequence number. i.e. A+1.
  • ACK: This is the final message of the connection establishment process from client to server. This message indicates that the client has successfully received an acknowledgment from the server. The sequence number is set to one more incremental value of the previous sequence number, i.e. B+1.

Protocols that used Transmission Control Protocol (TCP) :

TCP is a widely usable protocol at the Transport Layer. It is used by some famous protocols like HTTPS, HTTP, FTP, TELNET, SSH, etc.

Related Articles

References

Summary

TCP is the short name of the Transmission Control Protocol. TCP is guaranteed to deliver our data. Therefore it is a reliable protocol. Due to some extra messages (SYN, ACK, RST, and FIN), the overall communication speed is slower than UDP. It is widely used in different applications.

Did you like this article? Please share it on social media platforms and shows us some love 🙂

You May Also Like

About the Author: Vikash Kaushik

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link