TCP vs UDP
in a network device send data to another device, if there no rules for transportation that’s a big problem. if there no protocol or rules, it’s is commonly happen that we get low quality data because some packets of data are lost during transportation that’s why TCP stands for. We use TCP in many cases downloading files, sending SMS, mail etc.
But there are some disadvantages in TCP, yes TCP is reliable but slow because it is monitoring every data packets. In real world there are cases when we need more speed than reliable like streaming, video call, etc. Here comes UDP. UDP is more fast than TCP but less reliable. So we have options when what we use.
UDP does not established connection during sending data, it sends data without conforming the receipt and errors, it means some of data packets may be lost during transmission.
difference between TCP & UDP
| Factor | TCP | UDP |
| Connection type | Requires an established connection before transmitting data | No connection is needed to start and end a data transfer |
| Data sequence | Can sequence data (send in a specific order) | Cannot sequence or arrange data |
| Data retransmission | Can retransmit data if packets fail to arrive | No data retransmitting. Lost data can’t be retrieved |
| Delivery | Delivery is guaranteed | Delivery is not guaranteed |
| Check for errors | Thorough error-checking guarantees data arrives in its intended state | Minimal error-checking covers the basics but may not prevent all errors |
| Broadcasting | Not supported | Supported |
| Speed | Slow, but complete data delivery | Fast, but at risk of incomplete data delivery |
Which is Best?
It depends on what we are doing online and the type of data being transferred. UDP is better if we are gaming online, because its speedy data transfer allows for mostly lag-free gaming. TCP is better if we are transferring files, like family photos, because it ensures the data arrives exactly as it was sent.
TCP is BEST for:
Email or texting
File transfers
Web browsing
UDP is BEST for:
Live streaming
Online gaming
Video chat
How does UDP work?
The UDP protocol works by immediately firing data at the receiver who made a data transmission request, until the transmission is complete or terminated. Sometimes called a “fire-and-forget” protocol, UDP fires data at a recipient in no particular sequence, without confirming delivery or checking if packets arrived as intended.
