Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between TCP and UDP?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what the difference between TCP and UDP is, concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.

TCP

TCP (Transmission Control Protocol) is a connection-oriented protocol, that is, before sending and receiving data, a reliable connection must be established with the other party.

TCP header format

Serial number: used to number byte stream, for example, serial number 301 means that the first byte number is 301, if the length of the data carried is 100 bytes, then the serial number of the next packet segment should be 401. Acknowledgement Number: The sequence number of the next message segment expected to be received. For example, B correctly receives a message segment sent by A, the sequence number is 501, and the data length carried is 200 bytes. Therefore, B expects the sequence number of the next message segment to be 701, and the acknowledgement number in the acknowledgement message segment sent by B to A is 701. Data offset: refers to the offset of the data part from the beginning of the message segment, actually refers to the length of the header.·Acknowledgment ACK: The Acknowledgment Number field is valid when ACK=1, otherwise invalid. TCP specifies that ACK must be set to 1 in all transmitted segments after the connection is established.·SYN: Used to synchronize sequence numbers when a connection is established. When SYN=1 and ACK=0, this is a connection request segment. If the other party agrees to establish the connection, SYN=1 and ACK=1 in the response message. Terminate FIN: Used to release a connection. When FIN=1, it indicates that the sender's data of this message segment has been sent and requests to release the transport connection.·Window: The window value serves as a basis for the receiver to let the sender set its sending window. The reason for this limitation is that the data buffer space of the receiver is limited.

UDP

UDP (User Data Protocol) is a connectionless protocol in which the source and terminal do not establish a connection before transmitting data, and when it wants to transmit, it simply grabs data from the application and throws it onto the network as quickly as possible. At the sending end, UDP can transmit data at a speed limited only by the speed at which the application generates data, the computer's capabilities, and the transmission bandwidth.

UDP header format

The header field is only 8 bytes long, including source port, destination port, length, checksum. The 12-byte dummy header is added temporarily for computational verification purposes.

summary

TCP: connection-oriented, providing reliable services, flow control, congestion control, no duplication, no loss, no error, byte stream oriented (the application layer down the message as a byte stream, the byte stream organized into different sizes of data blocks), can only be point-to-point, the header 20 bytes, full duplex.

UDP: no connection, best effort delivery, no congestion control, packet-oriented (no merging or splitting of messages passed down by applications, only adding UDP headers), one-to-one, one-to-many, many-to-many support, header 8 bytes.

What is the difference between TCP and UDP? Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report