TCP and UDP – what are they and how are they different?

By Laura DanielczykNovember 23, 2020
TCP vs UDP

This post is also available in: polski

TCP (Transmission Control Protocol) and UDP (User Datagram Protcol) are the basic protocols used to transfer information and data between the user and the server. One of them will provide you with greater reliability, while the other will guarantee faster data transmission. Meet the TCP and UDP protocols!

What is TCP and how does it work?

The TCP protocol is the most widely used protocol on the entire Internet. This is due to the fact that it ensures adequate performance and significantly facilitates broadcast security. Due to the use of the TCP protocol, the server is less susceptible to DDoS attacks.

Data transfer within the TCP protocol is initiated by giving a data package a unique identifier. This is why the data can be recognized and sent in the right order to the recipient.

After receiving the data package and confirming its order, the server sends acknowledgment to the sender. After the sender sends back the relevant confirmation, the server will initiate the next data package.

If there is a problem during the transmission – e.g. information is lost or data is sent in the wrong order, the server will remain passive and it will be necessary to retransmit the entire data package.

The TCP protocol is usually used for data transmission between the server and client applications, sending e-mails, or various data files.

What is UDP and how does it work?

How does the UDP protocol work? Well, a little easier, and therefore a lot faster. UDP does not use unique identifiers and does not assign sequence numbers to the transmitted data. Data is streamed all at once, continuously, and without sequencing. Additionally, the recipient does not have to confirm the receipt or compliance. If a part of the data packet is lost during the transmission, the UDP protocol does nothing about it, so to speak, but continues the broadcast.

The effect of this can be observed, for example, in video games. If data transmission is blocked for any reason, the game will not stop, but after a while the player-controlled character will be teleported to another place.

TCP and UDP – what’s the difference?

Although both protocols are used to send data packets between the server and the recipient, the way they work is completely different.

The TCP protocol transmits data in single and structured packages, requiring return acknowledgment from the recipient. The connection between the recipient and the sender remains either open or is opened and closed while the data is being transferred. The way of operation of the TCP protocol ensures a much greater reliability of transmission, however, it comes at a lower rate of data transfer.

The UDP protocol does not require feedback, and the data is sent in bulk. As a result, this protocol provides a higher transmission speed. However, data streaming, the lack of error detection and correction, and the lack of congestion control make UDP more unreliable than TCP.

Summary: which protocol should I choose?

The UDP protocol is used where fast, efficient data transfer is required, no acknowledgment of receipt is required, and some data loss is tolerated. The protocol works well with 1: 1 bilateral broadcasts. In the case of sending large amounts of data, the TCP-IP protocol provides much better performance. The delays are greater, but the protocol itself provides incomparably greater stability in computer networks.

Storm Streaming Server uses TCP-IP to support, among others, the proprietary Storm protocol, as well as HLS, MPEG-DASH, CMAF or RTMP. In the upcoming updates, the WebRTC protocol will also be available in two variants: TCP-IP and UDP.


Tags: TCP, UDP