What is Transmission Control Protocol (TCP) ?

TCP stands for Transmission Control Protocol. It is a Transport layer protocol. The protocol number of TCP is 7. In the following article, we will discuss many features of TCP.

tcp-protocol-with-header
Transmission Control Protocol (TCP)

TCP is a connection-oriented protocol, which means a connection is established between source and destination devices before they start sending or receiving data. This connection process is known as a”The Way Handshake” process. The data from Application Layer is first coming to TCP. Now, TCP will add their header to this data, thus form a segment. This segment now delivered to Network Layer and 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 source to destination, the destination each time sends an acknowledgment message. This means, after the successfully received data by the recipient, the next data packet will be delivered. If there is some error during transmission of data, then the complete data packet is discarded by the recipient and request to send this data packet again. Thus, TCP is a reliable protocol that has a 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 forward to the TCP protocol. TCP divides this data into various chunks, and then TCP will add a Header on this data. After adding the TCP Header, now the data will send to the Network layer. Below is an overview of a TCP header.

tcp-header-explained-in-details

>> Click Here for Large Image

TCP Header all fields

  • Source Port: Source port is a 16-bit number that Identifies sending port.
  • Destination Port: Destination port is also a 16-bit number that Identifies 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: Acknowledgement number is also a 32 bits number, which is always an incrementing number of Sequence Number i.e. A+1.
  • Data offset: It is a 4 bits value that specifies the total size of the TCP header. It is also used to make sure that TCP header having in the range of 32 words.
  • Reserved: Reserved is a 3-bit number which is used for future usages. These bits are always set to Zero “0”.
  • Flags: Flags is a 9 bit filed, 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 filed, which specifies the size of receiving data stream.
  •  Checksum: Checksum is a 16 bit filed, which is used to 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 and used for various 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 starting 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 in order to establish a connection :

  • SYN: SYN stands for Synchronization. At starting, 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 which have a sequence number A and reply 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 which used Transmission Control Protocol (TCP) :

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

Summary

TCP is the short name of the Transmission Control Protocol. TCP 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 less then UDP. This protocol is widely used by Application Layer protocols.

Leave a Reply

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