This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14038|Reply: 1

[Source] Advantages, Disadvantages and Differences between TCP and UDP [Reprint]

[Copy link]
Posted on 3/8/2017 1:54:58 PM | | |

Advantages of TCP: Reliable and stable The reliability of TCP is reflected in the fact that TCP will have three handshakes to establish a connection before transmitting data, and when data is transmitted, there are confirmation, window, retransmission, congestion control mechanisms, and after the data is transmitted, it will also be disconnected to save system resources. Disadvantages of TCP: slow, inefficient, high system resource occupation, easy to attack TCP before transmitting data, to build a connection first, which will consume time, and when data is transmitted, the confirmation mechanism, retransmission mechanism, congestion control mechanism, etc. 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 a confirmation mechanism and a three-way handshake mechanism, TCP is easily exploited to achieve DOS, DDOS, CC and other attacks.

Pros of UDP: Fast and slightly more secure than TCPUDP does not have TCP handshake, confirmation, window, retransmission, congestion control, and other mechanismsUDP is a stateless transport protocol, so it is very fast when passing data. Without TCP, UDP has fewer vulnerabilities exploited by attackers than TCP. However, UDP cannot avoid attacks, such as UDP flood attacks...... 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 when data is transmitted. Based on the above advantages and disadvantages, then: When should you use TCP: When there are requirements for network communication quality, such as: the entire data should be accurately transmitted to the other party, which is often used in some applications that require reliability, such as HTTP, HTTPS, FTP and other file transfer protocols, POP, SMTP and other email transmission protocols. In daily life, the common applications using TCP protocol are as follows: browser, HTTP FlashFXP, FTP Outlook, POP, SMTP Putty, Telnet, SSH QQ file transfer............ When to use UDP: When the network communication quality is not high, the network communication speed is required to be as fast as possible, then UDP can be used. For example, in daily life, the common applications that use the UDP protocol are as follows: QQ Voice QQ Video TFTP ......

Some application scenarios require low reliability and use UPD, such as long video and speed

Summary Differences between TCP and UDP:

1. Based on connection and no connection;
2. Requirements for system resources (more TCP, less UDP);
3. The structure of UDP program is relatively simple;
4. Stream mode and datagram mode;

5. TCP guarantees data correctness, UDP may lose packets, TCP guarantees data order, and UDP does not.



The difference between TCP and UDP protocols
TCP UDP
Whether connected Oriented to Connections Oriented to non-connections
Transmission reliability reliable unreliable
Applications Transfer large amounts of data Small amounts of data
Slow and fast

Summary of the differences between TCP and UDP:

1. TCP oriented to the connection (for example, to make a call, you need to dial the number first to establish a connection);UDP is connectionless, meaning you don't need to establish a connection before sending data

2. TCP provides reliable services. That is, the data transmitted over the TCP connection is error-free, not lost, not duplicated, and arrives in order. UDP does its best effort to deliver, i.e. it does not guarantee reliable delivery

3. TCP is oriented to byte streams, which actually treat data as a series of unstructured byte streams; UDP is packet-oriented

UDP has no congestion control, so network congestion does not slow down the source host's send rate (useful for real-time applications such as IP telephony, 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 first part of TCP costs 20 bytes; The first part of UDP has a small overhead of only 8 bytes
6. The logic communication channel of TCP is a full-duplex reliable channel, while UDP is an unreliable channel




Previous:I accidentally discovered a DDOS website
Next:.net/c# UDP communication gadget [source code]
Posted on 3/28/2017 5:49:14 PM |
It feels okay, like this, so and so
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com