UDP vs TCP

Communication protocols are (in my opinion) one of the most difficult things to get a handle on when working on networking projects. Well, today we’re going to go over the differences between two common types of protocols (TCP and UDP). TCP (transmission control protocol) is the most standard protocol used. This is largely because, while slower then UDP, TCP is more reliable and allows for error-correction. This makes it ideal for loading websites and other sensitive things. UDP (user datagram protocol) is light-weight and fast, and that makes it great for things like audio and video files. If you’ve ever checked out the DEIPck and DEWFck examples in MPIDE, half the examples are UDP related, and the other half are TCP related, so if you want to test out the two, you can easily do so.

UDPvsTCp

 

Connection

How TCP and UDP handle connections is one of the main difference’s between the two. TCP requires a connection to work. Known as a “handshake”, the client and the server will communicate. UDP is connection-less, meaning a connection is not necessarily established before data is sent. Below is a comic I found in the office that represents how UDP connection works (more or less).

TCP vs UDP connection (more or less)
TCP vs UDP connection (more or less).

Speed

TCP is slower than UDP, but that isn’t necessarily a bad thing. TCP has a back and forth of information going on, and makes sure that the recieving computer isn’t being overloaded with information. UDP is sending as many packets of information as possible outwards. Taking those two things into account, you can see the pros and cons between the two. UDP is ideal for when you want quick updates (like video or audio files), and TCP is great for when you want sensitive projects (websites and file transfers).

Weight and Header Size

Weight is what the protocol is doing to actually work. TCP has a lot of things going on at once, UDP is sending out messages without being held down by things such as recovery options. This leads into the purpose of Header Size. The standard size of a TCP packet has a minimum size of 20 bytes, and a maximum of 60 bytes. The UDP packet consists of only 8 bytes for each packet.

 

Credit to Microchip
Image from Microchip.

 

Review

While there are more differences between UDP and TCP connections, the differences given in this blog are the most important ones and give the everyday user enough information on how choosing with protocol type would be best for their project!

Author

About Josh

I love Coding!

View all posts by Josh →

2 Comments on “UDP vs TCP”

  1. As TCP and UDP both are work on the sending the packets through transmission but the difference is that udp throws out all the error checking stuff out. The deliverability is slower as compared to Tcp.

  2. Both TCP and UDP are protocols used for sending bits of data known as packets over the Internet. They both build on top of the Internet protocol. In other words, whether you are sending a packet via TCP or UDP, that packet is sent to an IP address.

Leave a Reply

Your email address will not be published. Required fields are marked *