For anyone interested or working in IT, knowing what TCP/UDP are and what they are used for is essential information.
Let’s work through what they are and the differences between them in a very simple fashion.
What Is TCP/UDP Anyway?
When devices communicate over the Internet, they use a suite of protocols known as the TCP/IP Protocol Suite.
Within this protocol suite, data is sent most often using 1 of 2 methods: TCP (Transmission Control Protocol) or UDP (User Datagram Protocol). Which protocol is being used depends on the type of traffic being sent.
Let’s take a look at the differences between the two.
Differences Between TCP & UDP
TCP (Transmission Control Protocol):
- TCP establishes connections between devices before sending information. (See this post for an explanation of how the TCP 3 Way Handshake works). It ‘cares’ about where the traffic is being sent to
- Without doubt, TCP is the most reliable option between the two. TCP was built with the ability to acknowledge the fact that packets were received. This feature means that any data lost or corrupted in transit is recognised and resent until it arrives in perfect condition
- A downside to this is the inevitable latency that is caused by acknowledging every packet, or by data being lost and needing to be resent
- However in situations where it is critical to receive all the data sent without any acceptable loss or alteration, TCP is second to none
- TCP makes use of sequence numbers in order to establish which data has been sent, in what order and if any data is lost in transit
UDP (User Datagram Protocol):
- Unlike TCP, UDP doesn’t ‘care’ about establishing a connection with the device it is sending information out to. It simply sends out the information and hopes it makes its way over
- As a result of this, UDP is known to be the more unreliable of the two protocols. UDP has no way of establishing if the data sent was received
- Although this doesn’t seem like something to be celebrated, it results in the fact that UDP is faster than TCP. Data is sent faster without the need to ‘acknowledge’ the reciept of packets like TCP does
- Data is sent ‘as is’
Now that we know the main differences between the two protocols, let’s take a look at their uses in real life.
Example of Both UDP & TCP Uses
The below table showcases some of the times TCP or UDP might be used.
|Instant Messaging||Video Streaming|