The difference between TCP and UDP

Source: Internet
Author: User

First, the DNS domain Name System

(1) DNS domain Name System: A distributed database in which domain names and IP addresses are mapped to each other.

(2) The DNS protocol runs on top of the UDP protocol , using a port number of 53.

(3) Each IP address can have a host name, static mapping and dynamic mapping.

Ii. advantages and disadvantages of TCP and UDP

(1) TCP

The advantages of TCP: reliable , reliable stability of TCP reflected in TCP before passing data, there will be three handshake to establish a connection, and in the data transfer, there is Confirmation, window, retransmission, congestion control mechanism, after the data is transmitted, The connection is also disconnected to conserve system resources.

TCP Disadvantages: slow , inefficient, high occupancy system resources , vulnerable to attack ; TCP is used to establish a connection before it is delivered, which consumes time, and when data is passed, the mechanism of acknowledgement, retransmission, congestion control and so on will consume a lot of time. , and to maintain all transport connections on each device, each connection consumes the system's CPU, memory, and other hardware resources. Moreover, because TCP has the confirmation mechanism, three times handshake mechanism, these also can cause the TCP to be exploited, realizes the DOS, the DDoS and so on attacks.

TCP Application Scenario: when the network communication quality requirements , such as: the entire data to be accurate to each other, such as the browser (HTTP).

(2) UDP

The advantages of UDP: fast , slightly more secure than TCP,UDP does not have TCP handshake, confirmation, window, retransmission, congestion control mechanism, UDP is a stateless transport protocol, so it is very fast when transmitting data. Without these mechanisms of TCP, UDP is less vulnerable than TCP is exploited by attackers. However, UDP is also an unavoidable attack, such as a flood attack.

UDP disadvantage: Unreliable , unstable, because UDP does not have TCP those reliable mechanism, in the transmission of data, if the network quality is not good, it will be easy to lose packets.

UDP application Scenario: When the network communication requirements are not high, the need to network communication speed as fast as possible . such as QQ Voice.

Third, the difference between TCP and UDP

(1) TCP is connection-oriented and UDP is not connected, that is, you do not need to establish a connection before sending the data.

(2) TCP provides reliable services, that is, data transmitted over a TCP connection, error-free, not lost, not duplicated, and arrived in sequence, and UDP does its best to deliver, that is, does not guarantee reliable delivery. And because TCP is reliable, it is connection-oriented and does not lose data, so it is suitable for switching large data volumes.

(3)TCP is byte-oriented ,UDP is packet-oriented , and the network congestion does not reduce the transmit rate (so there will be packet loss, for real-time applications such as IP telephony and video conferencing, etc.).

(4) TCP can only be 1 to 1, and UDP supports 1 to more.

(5) TCP has a header larger than 20 bytes, and UDP has only 8 bytes

(6) TCP is a connection-oriented reliability transmission, and UDP is unreliable.

The difference between TCP and UDP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.