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 comes to TCP. Now, TCP will add their header on this data, thus form a segment. This segment now delivered to Network Layer and IP protocol will also encapsulate an IP header to from a packet. Thus, more commonly, it is known as TCP/IP stack.

Every time, when there is some transmission of data from source to destination, the destination each time sends an acknowledgement message. This means, after the successfully received data by recipient, next data packet will be deliver. If there is some error during transmission of data, then the complete data packet is discard by the recipient and request to send this data packet again. Thus, TCP is a reliable protocol which have feature of error checking and correction.

Header of Transmission Control Protocol (TCP)

As we already discussed, the data from application layer is always forward to TCP protocol. TCP divides this data into various chunks, and then TCP will add an Header on this data. After adding TCP Header, now the data will send to Network layer. Below is an overview to TCP header.

TCP Header all fields

  • Source Port : Source port is a 16 bit number which Identifies sending port.
  • Destination Port : Destination port is also a 16 bit number which Identifies receiving port.
  • Sequence Number : Sequence Number is an 32 bits random number i.e. A, which is send when a data steam is sent to receiving end.
  • Acknowledgment Number : Acknowledgement number is also a 32 bits number, which is always an increment number of Sequence Number i.e. A+1.
  • Data offset : It is a 4 bits value which specify the total size of TCP header. It is also used to make sure that TCP header having in the range of 32 word.
  • 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 have 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 purpose. If there is some error in TCP header, checksum field is responsible for error correction.
  • Urgent pointer : It is a 16 bit number, used when URG flag is set.
  • Options : Option is an variable length filed and used for various different purposes.
  • Padding : Padding is composed of zeros. It is used to determine that the TCP header end, and all data have in the range of 32 boundary.

Connection establishment and termination in Transmission Control Protocol (TCP)

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

  • SYN : SYN stands for Synchronization. At starting, client send a SYN flag to server, this indicate that a client wants to establish a connection with 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 client which have a sequence number A and reply an acknowledgement message to client with an incremental sequence number. i.e. A+1.
  • ACK : This is the final message of connection establishment process from client to server. This message indicate that client is successfully received acknowledgement from server. The sequence number is set to one more incremental value of previous sequence number, i.e. B+1.

Protocols which used Transmission Control Protocol (TCP) :

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

Summary

TCP is short name of Transmission Control Protocol. TCP guaranteed deliver our data, therefore it is 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 *