TCP vs. UDP – Reliability or Speed
Though TCP vs. UDP is the title of this article, they are not rivals! As a matter of fact, TCP and UDP are the most used protocol in Transport layer. Furthermore, to know about other layers of TCP/IP model, read this article. Afterward, this article will give you in depth knowledge about hos TCP and UDP protocol goes in action!
UDP stands for User Datagram Protocol. In this protocol data is sent unreliably. However, unreliably means, UDP protocol doesn’t verify if the sent data is received properly. As a matter of fact, UDP sends a data for a single time. Afterward it waits for the answer. Then the session is terminated.
For instance, DNS protocol uses UDP protocol. No doubt that, every internet user uses DNS protocol. Actually, what DNS protocol does is, it sends a question or inquiry to DNS server. That question includes the website address what was entered in a browser. At this point, DNS server returns the IP address of that website. However, DNS server doesn’t have the record for that website, it sends a return message about saying that. Ultimately, this is all happens in a single instance of UDP a session. No confirmation or acknowledgment is used in this protocol
TCP stands for Transmission Control Protocol. In any case, this protocol send data reliably. Meaning, sent data will be received by the expected receiver. For this purpose, TCP uses SYN and ACK packets. It sends a SYN packet, waits for an ACK packet. Afterward if it gets ACK packet, it sends next packet. If it doesn’t get ACK packet, it sends previous packet again. Here, packets refers to data, in general sense.
For example, HTTP protocol uses TCP protocol. Of course, every internet users also use HTTP protocol every day. First, TCP protocol sends a SYN packet to receiver, in this case to any website. SYN packet simply means, it wants to “speak” with the website. Then, if the website is ready to communicate, it sends SYN, ACK. Actually this means, the website has got the SYN packet and wants to communicate. Then again, from users side a ACK packet is sent to the website. Afterward, they start communicating using this protocol for every data transmission. This method is called Three Way Handshake. It is reliable because ACK packet is used to confirm if data is received by the expected receiver.
TCP vs. UDP – Final Words
So we have seen how, both TCP and UDP works. Both are widely used. As a matter of fact, both are crucial. When speed is more important than reliability, UDP is used. Like DNS or Video streaming or VoIP. On the other hand, where reliability is the priority, there TCP is used. Like HTTP protocol. Users need all the data to brows a website effectively. All things considered, both are important protocol for network communication. Also both are essential for each other. Have fun!