Socket communication based on UDP protocol/Introduction to UDP protocol/Search for DNS based on UDP protocol/Introduction to process/Development history of operating system and process

Both TCP and UDP are protocols that work based on ports. TCP has a link, UDP has no link. The TCP protocol will also lose packets (there is a problem with the network, the data may be lost)

The application is sent to the cache of the operating system, and the operating system takes it out of the cache. Once the data is lost, it is completely gone. TCP is reliable because after receiving the confirmation information, the data in its own cache will be emptied.

The working principle of UDP I took it out of my own cache and sent it directly. After sending it, I emptied the cache. The speed is definitely faster to close TCP. UDP has no link, and more data is sent without considering the ack information from the other party (the problem data packet is lost once it is lost)

 

Question 1: Why is the TCP protocol reliable?

Incorrect answer: Because the TCP protocol has a link. (It has nothing to do with the nature of the link, it has to do with the working principle)

Correct answer: The reason why the TCP protocol is reliable is that the data in its own cache will not be cleared until it responds to ack every time a data is sent. If you don't reply to ack and send it again, it's reliable here.

    The reason why the UDP protocol is unreliable is not because there is no link, but because the cache is emptied immediately after the data is sent.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325112164&siteId=291194637