Current location - Quotes Website - Team slogan - Which protocols are based on TCP and which are based on UDP?
Which protocols are based on TCP and which are based on UDP?
/rj03 Hou/archive/2008/06/09/252579 1 . aspx

Why should HTTP use TCP?

1, if you use UDP, there will be many errors in the source file of the webpage after transmission, and the browser will be crazy when parsing! ! !

2.udp links are insecure and unreliable, and are mainly used in applications with low security requirements and high efficiency requirements, such as chat programs.

The internationally popular protocol is TCP/IP protocol, and the ports below 1024 are precisely defined, which correspond to some common services on the Internet. These common services can be divided into two types: using TCP port (connection-oriented) and using UDP port (connectionless-oriented).

Speaking of TCP and UDP, we must first understand the meaning of "connection" and "connectionless". Their relationship can be illustrated by a vivid metaphor, that is, calling and writing letters. When two people want to talk, they must first establish a connection-that is, dial when making a phone call and wait for a response-that is, they can send messages to each other after answering the phone, and finally they must disconnect-that is, hang up. It is easier to write letters. Fill in the recipient's address and put it in the mailbox, and the recipient can receive it. From this analysis, we can see that the establishment of the connection can establish a channel to transmit information when both sides need to be sad. After the sender sends a connection request, the receiver responds, because the information is transmitted only after the receiver responds, and it is transmitted in a channel, so the receiver can receive the information sent by the sender relatively completely, that is, the reliability of information transmission is relatively high. However, it is precisely because of the need to establish a connection that the resource cost increases (you must wait for the response of the receiver before establishing a connection, and you must confirm whether the information has been transmitted and send the corresponding signal when disconnecting, etc.). ), so you can monopolize one channel, and when you disconnect, you can't establish another connection, that is, the third party can't call in during the conversation between two people. Connectionless is to send information from the beginning (strictly speaking, it has no beginning and end), and it is only a one-time transmission, and the receiver does not need to respond first, so the reliability of information transmission cannot be guaranteed to some extent. Just like writing a letter, we just send it out, but there is no guarantee that the recipient will receive it.

TCP is connection-oriented and has high reliability. Some demanding services generally use this protocol, such as FTP, Telnet, SMTP, HTTP, POP3 and so on. , and UDP is connectionless. Common services using this protocol include DNS, SNMP, QQ, etc. For QQ, it must be explained separately that before QQ2003 only used UDP protocol, its server used 8000 port monitor information to arrive, and the client used 4000 port to send information (it is not difficult to understand why the port used to display friends' IP address information in general IP-displaying QQ version is often 4000 or its subsequent port), that is, QQ programs both accept and provide services, and support the use of TCP protocol in future QQ versions.