difference between udp vs tcp ????



difference between udp vs tcp ????

In: Technology

UDP is like getting a letter in the mail containing all the requested information.

TCP is like getting a letter in the mail, calling the sender, and verifying the words on the letter.

TCP checks everything. It’s slower, but more reliable:

* A: I’m sending you a thing!
* B: Acknowledged!
* A: Here’s the thing!
* B: I got it!
* A: I’m done sending things now!
* B: Acknowledged!

UDP checks nothing. It’s faster, but less reliable:

* A: Here’s the thing!
* (That’s it)

UDP is better when speed is crucial (e.g. gaming). TCP is better otherwise, whenever a slight delay doesn’t matter (e.g. most anything you do online).

TCP is a robust layer 4 protocol that runs on top of the layer 3 IP protocol. It has lots of extra data added for redundancy such as error correction data. It’s really useful when data needs to arrive correctly.

UDP is a different layer 4 protocol running on IP. is slightly more fast and loose, it lessens the amount of error correction data to increase actual data. This is fine in some instances.

You *wouldn’t* use UDP to transfer your bank details, since the possibility of errors is much greater. Likewise, you *shouldn’t* use TCP for things like streaming video, since a bit error when streaming video is normally inconsequential and using TCP would be a waste of bandwidth.

It is worthy to note that udp is used when continuity of transmission is preferred over integrity of data.

For instance, when you’re streaming or calling over the internet, the data is being transmitted to your device using udp, because it is more preferable that your stream/call continues uninterrupted. That’s why the stream/call quality may drop sometimes(because a few packets were lost along the way and the mechanism doesnt bother spending time to ask for them again. So the occasional drop of quality you experience is actually those packets being lost.
On the other hand, for stuff like sending an email, where every single bit is necessary, you tcp/IP so that the integrity of the contents is maintained.