Ethical Hacking Tutorial

Transmission Control Protocol (TCP) in Computer Networking

What is Transmission Control Protocol (TCP)?

TCP is a standard protocol to define the ways for creating and managing the connections between devices in a network for the exchange of packets of data. It maintains the connection to ensure that the data is exchanged between the devices. 

This protocol also solves several challenges related to packet-based messaging. These challenges can be out-of-order packets, duplicate packets, corrupted packets, etc. TCP works with the Internet Protocol (IP).

TCP Three-Way Handshake

1. Synchronize Sequence Number (SYN)

This is the first step where a segment with SYN is sent to the server when there is a connection to be formed between the client and the server. 

2. SYN and ACK

Here, the server responds to the connection request with an Acknowledgement (ACK) to show that it has received the request of the client. It also tells about the SYN number with which it is likely to start the connection. 

3. ACK

In the last step, the client responds to the server with its acknowledgment. Then the connection is formed for data transmission. 

TCP Session Termination

The communication between the two parties in a network can end in two ways:


Here, both parties choose to terminate the connection.


In this, one party terminates the connection from both sides. 

TCP Flags

The role of TCP flags is to signal the state of the connection or to inform the other party about acknowledgment, termination, and resetting the connection. 

Here are some of the flags used in TCP:

  • SYN: To tell the other party in a connection about the synchronizing sequence number with which the connection can be formed. 

  • ACK: To acknowledge the connection request from the other party.

  • FIN: To request for finishing or terminating the connection when the data has been transmitted.

  • RST: This flag is used to reset the connection if the parties find some error or issue in the formed connection. 

  • PSH: PSH (Push) flag tells the receiver to send the data as it buffers, instead of waiting for all the data to be buffered first and then sending it. 

  • URG: It signals the other party to send the processed packets of data immediately or with urgency, even if some more packets of data are to be processed.

 flags used in TCP in Ethical hacking

Did you find this article helpful?