Home  >  Article  >  Backend Development  >  Compare the differences between TCP and UDP

Compare the differences between TCP and UDP

巴扎黑
巴扎黑Original
2017-09-06 11:06:081508browse

TCP (Transmission Control Protocol):

1) Provides reliable transmission of data in an IP environment (the byte stream sent by one computer will be sent to other computers on the network without errors, and computer A When receiving a data packet, it will also send the data packet back to computer B, which will also generate some traffic), effective flow control, full-duplex operation (data can be transmitted in both directions at the same time), multiplexing service , is connection-oriented, end-to-end transmission;

2) Connection-oriented: A connection must be established with the other party before formal communication. Open up a well-connected channel for the data to be sent in advance, and then send the data, like making a phone call.

3) Application protocols supported by TCP: Telnet (remote login), FTP (File Transfer Protocol), SMTP (Simple Mail Transfer Protocol). TCP is used for applications that transmit large amounts of data and require high reliability.

UDP (User Data Protocol)

1) For non-connection (you don’t need to establish a connection with the other party before formal communication, just send it directly regardless of the other party’s status, like SMS, QQ ), cannot provide reliability, flow control, and error recovery functions. UDP is used for applications such as transmitting only a small amount of data at a time, low reliability requirements, and economical transmission.

2) Application protocols supported by UDP: NFS (Network File System), SNMP (Simple Network Management System), DNS (Domain Name System), TFTP (Universal File Transfer Protocol), etc.

Summary:

TCP: connection-oriented, reliable transmission (guarantee data correctness, data order), used to transmit large amounts of data (streaming mode), slow, and requires a lot of overhead to establish a connection More (time, system resources).

UDP: Non-connection oriented, unreliable transmission, used to transmit small amounts of data (packet mode), fast speed.

The above is the detailed content of Compare the differences between TCP and UDP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn