Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the advantages, disadvantages and differences of TCP and UDP?

Shulou Source: shulou.com Published: 2022-06-02 03:18:03 10月31日 Update

Today, the editor will take you to understand the respective advantages and disadvantages and differences between TCP and UDP. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article together with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about the respective advantages and disadvantages and differences between TCP and UDP.

Advantages of TCP: reliable and stable. The reliability of TCP is reflected in that TCP has three handshakes to establish a connection before transmitting data, and there are mechanisms of confirmation, window, retransmission and congestion control during data transmission. After data transmission, the connection will be disconnected to save system resources.

The disadvantages of TCP: slow, low efficiency, high occupation of system resources, easy to be attacked. TCP needs to build a connection before transmitting data, which will consume time. Moreover, during data transmission, confirmation mechanism, retransmission mechanism, congestion control mechanism and so on will consume a lot of time, and all transmission connections must be maintained on each device. In fact, each connection will occupy the system's CPU, memory and other hardware resources. Moreover, because TCP has confirmation mechanism and three-way handshake mechanism, TCP is easy to be used to realize DOS, DDOS, CC and other attacks.

The advantages of UDP: faster, slightly safer than TCP UDP does not have TCP handshake, confirmation, window, retransmission, congestion control and other mechanisms, UDP is a stateless transmission protocol, so it is very fast when transmitting data. Without these mechanisms of TCP, UDP is less exploited by attackers than TCP.

Disadvantages of UDP: unreliable and unstable. Because UDP does not have the reliable mechanism of TCP, it is easy to lose packets if the network quality is not good during data transmission.

The difference between TCP and UDP:

1. TCP is connection-oriented (for example, dial-up to establish a connection first); UDP is connectionless, that is, there is no need to establish a connection before sending data.

2. TCP provides reliable service. In other words, the data transmitted through the TCP connection is error-free, not lost, not repeated, and arrives in sequence; UDP does its best to deliver, that is, reliable delivery is not guaranteed.

3. TCP is oriented to byte stream. In fact, TCP regards data as a series of unstructured byte streams; UDP is message-oriented. UDP has no congestion control, so network congestion will not slow down the transmission rate of the source host (useful for real-time applications, such as IP phones, real-time video conferencing, etc.).

4. Each TCP connection can only be point-to-point; UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communication.

5. The overhead of the first part of TCP is 20 bytes, while that of UDP is only 8 bytes.

6. The logical communication channel of TCP is a full-duplex reliable channel, while UDP is an unreliable channel.

Thank you for your reading, the above is the whole content of "what are the advantages, disadvantages and differences of TCP and UDP?" learn friends to hurry up to operate. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!

Tags: Data mechanisms controls advantages and disadvantages channels friends systems resources attacks advantages content bytes real-time overhead articles time knowledge shortcomings networks follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information Microsoft vpn OPPO Reno