Udp (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 data packets directly!
UDP is suitable for the application environment where only a small amount of data is transmitted at a time and the reliability requirement is not high. 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 packet to the other host, and then the other host confirms the receipt of the packet. If the message of whether the packet arrives is fed back in time, then the network is connected. For example, by default, the ping operation sends four packets (as shown in Figure 2). As you can see, the number of packets sent is 4, and the number of packets received is also 4 (because the other host will send back a packet to confirm receipt). This fully shows that UDP protocol is a connectionless protocol, and there is no process of establishing a connection. Because UDP protocol has no connection process, the communication effect is high; But because of this, its reliability is not as high as TCP protocol. QQ uses UDP to send messages, so sometimes you can't receive messages.
The difference between tcp protocol and udp protocol
TCP UDP
Whether the connection is connection-oriented, connection-oriented or non-connection-oriented.
Transmission reliability is reliable and unreliable.
Applications transmit large amounts of data and small amounts of data.
Slow and fast