Skip to main content
X

Explore your training options in 10 minutes

Coding

TCP vs. UDP: A Guide

James Gallagher - September 16, 2020


There are two protocols used to transmit data between networked devices : TCP and UDP. These two protocols are both part of the Internet Protocol (IP).

This guide discusses what these protocols are and how they work. We’ll discuss the main advantages and drawbacks of communicating information over TCP and UDP.

What is TCP?

TCP/IP , or Transmission Control Protocol/Internet Protocol, is a communication protocol that connects devices between multiple computer networks. This protocol was designed to seamlessly stream data over a network that may not have a reliable connection.

Get offers and scholarships from top coding schools illustration

Find Your Bootcamp Match

  • Career Karma matches you with top tech bootcamps
  • Access exclusive scholarships and prep courses










By continuing you agree to our Terms of Service and Privacy Policy , and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

On a TCP connection, data can travel in both directions. Data is transmitted through packets.

TCP is considered more reliable than its UDP counterpart. This is because TCP performs error correction that reduces a chance that a connection will drop out.

A TCP connection is made using a method called a handshake, where a computer initiates a connection. Once that connection has been created, a transmission begins, after which point the transmission ends.

This method is beneficial because data going through a handshake must be structured. This is another reason why TCP is so reliable.

What is UDP?

User Datagram Protocol, or UDP, is another protocol used to send data over a network.

The main benefit of UDP is that it works well with applications that use a lot of bandwidth, such as video streaming.

This protocol is similar to TCP in that it transmits data. With that said, UDP has more limitations. Unlike TCP, UDP does not perform error checking and there is no support for bidirectional communication. This means connections are one-way and more prone to errors.

UDP does not use the handshake method for transmitting information. Instead, UDP messages are packets sent individually to a network. There is no order to the sent packets because they are all individual; each packet does not know that another packet exists.

When is TCP Used?

TCP is best used for applications that need all the data that is sent. This is because TCP has a number of safeguards that can recover lost data if a connection drops out before all the information is transmitted.

For instance, a website may use TCP because losing information about a webpage may make successfully rendering a webpage in a browser impossible. TCP is commonly used for sending emails, retrieving web pages , and sending files over FTP.

When is UDP Used?

UDP is best used for applications that need speed. This is because UDP does not check for errors and does not have many of the fallbacks that TCP has.

Venus, a software engineer at Rockbot

"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"

Venus, Software Engineer at Rockbot

UDP has become common in video transmission and live streaming, where large amounts of data are sent. Video data must be transmitted quickly, otherwise the user’s video player would buffer.

Gamers commonly use UDP for its speed. Network issues such as lag and dropping connections can have a significant impact on gaming because gamers need to be connected to a server for the duration of a game.

The Bottom Line

There is no rule saying “TCP is better than UDP” or vice versa. It depends on your use case.

The reliability and safeguards offered by TCP makes it great for applications that depend on being able to receive all the data that is sent over a network. These applications include loading web pages and sending email.

UDP, on the other hand, is the better protocol in terms of speed. For applications that require a consistent connection, such as video streaming, speed is essential, which is why UDP is still around despite its drawbacks.

Now you have the knowledge you need to understand TCP, UDP, and the advantages and disadvantages of each protocol.

About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.

What's Next?

James Gallagher

About the author: James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others. He also serves as a researcher at Career Karma, publishing comprehensive reports on the bootcamp market.

Skip to main content