In the IT world, when we talk about reliable communication across any systems, TCP is the underlying protocol responsible for such connections to be successfully completed. In this article, we will discuss about basics of TCP and TCP Flags used in TCP header.
Topic of Content:
- Transmission Control Protocol
- Three-Way handshake
- List of TCP flags
Transmission Control Protocol (TCP)
Transmission Control Protocol is a transport layer protocol. It continuously receives data from the application layer and it divides the data into chunks where each chunk is a collection of bytes. TCP Segment is summation of TCP Header and Data Chunks. TCP segments are encapsulated in the IP datagram.
TCP is majorly used by applications that require guaranteed delivery of packets. It is a sliding window protocol, so it provides handling for both timeouts and retransmissions.
Related – TCP VS UDP
Establishing a TCP connection requires that both the client and server participate in a three-way handshake.
- Sender sends a SYN packet to the receiver.
- The receiver responds with a SYN/ACK packet to the sender, acknowledging the receipt of the connection request.
- The sender receives the SYN/ACK packet and responds with an ACK packet to receiver.
List of TCP flags
TCP flags are used with TCP packet transfers to indicate a particular connection state. This is required for troubleshooting purposes. Information from Flags also control how a particular connection is handled. There are few TCP flags that are commonly used –
- URG (1 bit – URGENT): The urgent flag is used to notify the receiver to process the urgent packets before processing all other packets. The receiver will be notified when all data has been received.
- ACK (1 bit – ACKNOWLEDGE): The acknowledgment flag is used to acknowledge the successful receipt of a packet. The receiver sends an ACK as well as a SYN in the second step of the three way handshake process to tell the sender for receiving its initial packet.
- PSH (1 bit – PUSH): Push flag is somewhat similar to the URG flag and tells the receiver to process these packets as they are received instead of buffering them.
- RST (1 bit – RESET): Reset the connection. It indicates the receiver to terminate the connection immediately when unrecoverable errors occur. It causes both the sides to release the connection and all its resources abnormally. The transfer of data ceases in both the directions. It may result in the loss of data that is in transit.
- SYN (1 bit – SYNCHRONIZE): It is used in first step of connection establishment phase or 3-way handshake process between the two hosts. This flag should be set to 1 when connection established between sender and receiver. This is used for synchronizing sequence number i.e. to tell the other end which sequence number they should accept.
- FIN (1 bit – FINISH): It is used to request for connection termination i.e. termination of connection between sender and receiver when there is no more data. This is the last packet sent by sender. It frees the utilised resources and gracefully terminates the connection.
Related – TCP FIN VS RST Packets
We discussed about total of 6 flags. The flags are always set to 0 or 1 and all being of 1 bit. They are used in data transmission between sender and receiver. Flags are used to instruct when transmission will start and stop.
ABOUT THE AUTHOR
I am here to share my knowledge and experience in the field of networking with the goal being – “The more you share, the more you learn.”
I am a biotechnologist by qualification and a Network Enthusiast by interest. I developed interest in networking being in the company of a passionate Network Professional, my husband.
I am a strong believer of the fact that “learning is a constant process of discovering yourself.”
– Rashmi Bhardwaj (Author/Editor)