Computer Science Logo
TCP Flags - TCP Communication methods

TCP Flags – TCP Communication methods

Prerequisite:


TCP Stands for “Transmission Control Protocol”. It is a way of communication that uses the Network Layer to transfer the data among the nodes. If you don’t know and want to read more about “Network Layers”, click here. TCP Uses the flags to communicate before the data transmission and uses handshakes to establish and close the connection. You can read more about TCP Handshakes here. Without any further ado let’s get started with the article on what are the TCP Flags and how they are used by TCP.

TCP Flags

TCP is a way of Secure communication in which the network makes sure that every data packet has reached its destination without any loss in the packets. It uses the Flags to communicate with the receiver and ask for a confirmation on each packet it sends. It also uses the flags to establish the connection with the receiver so that it can know that receiver is able and willing to receive the data. Here is a detailed description of the most common TCP Flags and their function.

Synchronization SYN

TCP uses the SYN flag to establish the connection between client and server. This is a flag that TCP uses to synchronize itself to the receiver so that it can start sending the data. This flag also tells the receiver that, in what sequence the packets are coming.

Acknowledgment ACK

The ACK flag ensures the delivery of the packet. The receiver sends an ACK flag to the sender each time it receives a packet. This is how the sender knows that receiver has received my packet. Each packet has a sequence number and the receiver sends an ACK flag with a number corresponding to the sequence number on the packet. For Example, if the sender sends three packets in a sequence of “SYN-1, SYN-2, and SYN-3”. Then the receiver will send “ACK-1, ACK-2, ACK-3” to the sender. Three-Way Handshake also uses the SYN and ACK flags to establish the connection.

Finish FIN

To terminate or finish the connection, TCP uses the FIN flag. The sender attaches a FIN flag with the last packet of the data to let the receiver know that the sender has finished sending the data and wants to terminate the communication. Four-Way Handshake uses the FIN flag to terminate the connection between sender and receiver.

Reset RST

TCP uses the RST flag to terminate the connection as well. When the receiver feel that something is wrong with the packet so it sends a RST flag to the sender to let him know that there is something wrong and the we have to terminate the connection. It also happens when a receiver receives a packet but it was not expecting any packet.

Difference Between FIN and RST TCP Flag

Finish (FIN)Reset (RST)
To end the connection gracefullyRST flag is used to terminate the connection if something wrong happens with the TCP connection
Ensures no data lossAll the data will be discarded if the RST flag is sent
The receiver can continue the connection if the receiver wants to even after the FIN is sentThe connection has to be stopped
To finish one side of the connectionThe whole conversation is stopped
Difference Between FIN Flag and RST Flag

Urgent URG

When the Sender wants to send a packet which is urgent then it includes a URG flag in its header. The packet with URG flag has the most priority over other packets. It forwards the packet with this flag to the application layer immediately even if there are other pending packets in the queue to the application layer. When the transmission is successful, the receiver is notified.

Push PSH

Transport layer usually uses the buffer space to store packets for a few amount of time before sending it over the network so that equal amount of data is send every time. Buffer is a small space where all the packets wait for a while before the router send them to the internet. Some applications does not want their packets to wait like messaging applications.

When a transport layer receives a packet with PSH flag it does not wait for the correct amount of data rather it immediately transmits all the data over the internet.

The same thing happen on receiver\’s end. When it receives the packet with PSH flag it knows that this packet cannot wait and I have to process it immediately. Please keep in mind that PSH flag will not transmit out of order. The receiver will process all the packets in the queue in order.

Difference Between PSH and URG TCP Flag

Push (PSH)Urgent (URG)
All the data in the buffer is pushed for processingIt only sends the urgent data to the receiver
The data is delivered in a sequence in which it has been sentThe data is delivered out of sequence
Difference between PSH Flag and URG Flag


Thank you for visiting our website CSinfos.com! If you have any queries or if you want to talk about anything you can join our community on our Facebook page “Computer Science“. and you can ask whatever is on your mind right now. You can suggest to us any topic that you want us to explain just like this article.

Table of Contents

Share This Post With Your Friends

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on email
Share on print
Share on tumblr
Share on pinterest
Share on vk
Share on odnoklassniki
Aftab Ahmed

Aftab Ahmed

I am a student of Computer science and I explain the topics of Computer Science in a way that everyone can understand. My job is to make the topics simple for everyone so that they don't have to read through long and difficult books in order to understand the concepts.

Symmetric and Asymmetric Cryptography explained

What is Symmetric and Asymmetric cryptography?

If you decided to not read the above articles for some reason let’s have a sneak peek into what those words basically mean. The word Cryptography has been derived from the Greek word “kryptós” which means “Hidden or Secret”. Before we get further into it let’s discuss why do we even need encryption in the first place?

Read More »
TCP Flags - TCP Communication methods

TCP Flags – TCP Communication methods

TCP is a way of Secure communication in which the network makes sure that everything that has been sent has reached its destination without any loss in the packets. It uses the Flags to communicate with the receiver and ask for a confirmation on each packet it sends. It also uses the flags to establish the connection with the receiver so that it can know that receiver is able and willing to receive the data. Here is a detailed description of the most common TCP Flags and their function.

Read More »

4 thoughts on “TCP Flags – TCP Communication methods”

  1. I would like to thank you for the efforts you’ve put in writing this blog.
    I’m hoping to see the same high-grade content by you in the future as
    well. In fact, your creative writing abilities has inspired me
    to get my very own site now 😉

  2. Aw, this was an extremely nice post. Spending some time and actual
    effort to generate a good article… but
    what can I say… I procrastinate a lot and don’t seem
    to get nearly anything done.

  3. I have to thank you for the efforts you have put in penning this
    blog. I really hope to check out the same high-grade content by you later on as well.
    In truth, your creative writing abilities has inspired me to get my
    own, personal site now 😉

Leave a Comment

Your email address will not be published.