Skip to main content

Command Palette

Search for a command to run...

TCP vs UDP

Published
•3 min read•View as Markdown

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

FactorTCPUDP
Connection typeRequires an established connection before transmitting dataNo connection is needed to start and end a data transfer
Data sequenceCan sequence data (send in a specific order)Cannot sequence or arrange data
Data retransmissionCan retransmit data if packets fail to arriveNo data retransmitting. Lost data can’t be retrieved
DeliveryDelivery is guaranteedDelivery is not guaranteed
Check for errorsThorough error-checking guarantees data arrives in its intended stateMinimal error-checking covers the basics but may not prevent all errors
BroadcastingNot supportedSupported
SpeedSlow, but complete data deliveryFast, 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:

  1. Email or texting

  2. File transfers

  3. Web browsing

UDP is BEST for:

  1. Live streaming

  2. Online gaming

  3. 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.

UDP works by firing data from server to device until all data is transferred or the connection is terminated.