TCP is a connection-oriented
UDP is for non-connected
That's the relationship.
TCP (transmission Control Protocol, transmission protocol)
UDP (user Datagram Protocol, Subscriber Packet Protocol)
When the IP packet transmits data to the destination via routing, different applications are requested and obtained based on the source port and destination port information in the TCP or UDP header. In other words, both TCP and UDP contain the source port and destination port information that the network service must have to establish and implement the network transport service. At this point, your question is: Since all are used for transmission, why do you have to engage in two different protocols? This needs to be discussed from the needs of different services in the network.
In the network, some services, such as HTTP, FTP, and so on, the reliability of the data requirements are high, in the use of these services, it is necessary to ensure that the packet can be fully delivered, and some other services, such as DNS, Instant messenger, etc., do not need such high reliability, high efficiency and real-time is their concern. Based on the different requirements of the two services, the connection-oriented TCP protocol was born, and the UDP protocol was oriented to the non-connection.
The connection (Connection) and the No connection (connectionless) are the common terms used in network transmission, and their relationship can be illustrated by a figurative analogy, that is, to call and write letters.
When making a phone call, a person must first dial (make a connection request), wait for the other person to respond, answer the call (establish a connection), and then pass the message to each other. After the call is complete, you also need to hang up the phone (disconnect) before completing the entire call process. Writing a letter is different, you just fill in the address of the addressee, and then put the letter into the post office, even if the task completed. At this point, the Post Office will send the letter to the designated destination based on the address information of the addressee.
A brief introduction to the vernacular tcp/udp-oriented connection, non-connection-oriented differences