UDP (User Data Protocol, User Datagram Protocol) is a protocol corresponding to TCP. It is a non-connection-oriented protocol, it does not establish a connection with the other party, but sends the data packet directly! UDP is suitable for application environments that only transmit a small amount of data at a time and do not require high reliability. For example, we often use the "ping" command to test whether the TCP/IP communication between two hosts is normal. In fact, the principle of the "ping" command is to send a UDP data packet to the other host, and then the other host confirms the receipt of the data packet. If the message of whether the data packet arrives is returned in time, then the network is connected. For example, in the default state, a "ping" operation sends 4 packets (as shown in Figure 2). As you can see, the number of data packets sent is 4, and the number of packets received is also 4 (because the other host will send back a data packet to confirm receipt). This fully shows that the UDP protocol is a non-connection-oriented protocol, and there is no process of establishing a connection. Because the UDP protocol has no connection process, its communication effect is high; but because of this, its reliability is not as high as the TCP protocol. QQ uses UDP to send messages, so sometimes messages cannot be received.
The explanation of TCP and UDP in these two paragraphs is still very straightforward.
In fact, the difference between TCP and UDP is still obvious
TCP is connection-oriented, while UDP is connectionless
TCP transmission is very reliable, but unreliable compared to UDP
TCP should be used to transmit large amounts of data, while UDP is suitable for small amounts of data
Finally, the most important thing is that the speed of TCP is slow, but it is faster than UDP.
If you have any questions, you can tell me at any time so that I can correct them in time. Thank you for your support.