TCP
- File transfer needs to be segmented for each data packet a sequence number, to ensure the correct order after receiving assembly
- Client and server to establish a session
- The server sends a reliable transmission of data packet loss, the client notifies the server resend
- flow control
establish connection
Three-way handshake protocol
Terminate the connection
Four-way handshake
UDP
- A packet data communications can be completed, you do not need to segment
- No need to establish a session
- Unreliable delivery
- Flow control is not required
- Efficient transport
Scenarios
QQ chat using the UDP protocol
As the chat software, how can such a reliable way to transmit messages not it? Thus, using the upper protocol Tencent ensure reliable transmission: If the client is using UDP protocol message is sent, the server receives the packet, it is necessary to use UDP protocol sends back a response packet. So to ensure that messages can be transmitted without omission. The reason occurs on the client clearly see the "failed to send a message," but the other party has received the news of the situation, because the message is sent by the server client has received and forwarded successfully, but the client did not receive a server due to network reasons the cause of the response packet.
QQ transfer files using the TCP protocol
= + Transport layer protocol port number corresponding to the application layer protocol
TCP + 80 = HTTP
TCP + 443 = HTTPS
TCP + 3389 = RDP
TCP + 21 = FTP
TCP + 25 = SMTP (mail)
TCP + 110 = POP3 (incoming mail)
UDP + 53 = DNS (domain names into IP addresses)