What is the difference between TCP and UDP?

difference between tcp and udp

Let’s spell out the acronyms first. TCP stands for Transmission Control Protocol and UDP stands for User Datagram Protocol.

In networking we often use the OSI model as a reference to clarify on which layer of the OSI model a protocol is used. We did an article on the OSI model and troubleshooting earlier this week.

TCP: what do you look like?

When it comes to properties of TCP is that it is lossless (guaranteed delivery and connection oriented. Both of these properties go a bit hand in hand. Because of the use of a connection (sometimes called state) every party in the conversation knows exactly where things are at. What did we send, what was received, how big are the packets that we can send … It seems like the perfect protocol.

And you: UDP?

Well, as you might have guessed UDP is the exact opposite of TCP as it has no guaranteed delivery but just ‘best effort’ AND it is connection-less.

An easy choice, right?

From the comparison we would be tempted to go for TCP all the time as it offers a lot things that we want and UDP is kind of trying but not really getting there. Well, you are wrong.

Think about the scenario where you want to transfer a file from one computer to another. What is the most important thing? That the file gets there and is not corrupt, correct? So in this scenario we could use FTP, SCP or SFTP and they all use TCP as a transport layer protocol. It doesn’t really matter how long it takes, but the file needs to be transferred in its entirety.

Another scenario: say you are in a video conference call at work. You would think that video conferencing or phone conferencing is really important, because earlier these calls were not so common as now, post Corona, and mostly done by management. You would use a protocol that uses TCP, right? Because it’s important that there is good quality of image and/or audio …? WRONG! Let’s say that we drop a few packets during a video conference. Is that bad? Yes a little bit, BUT does showing this images that we ‘lost’ do any good to the conference if we display them 5 seconds later (or even 0.5 seconds later). NO … because people have moved on in the conversation and trying to save everything, what TCP would do, would create a bad user experience.

So YES, UDP … we love you too! 😉

Categories

Latest articles

Latest comments

No comments to show.

All Splunk Posts