In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
The Internet is actually an architecture made up of ideas and protocols. Among them, the protocol is a set of well-known rules and standards, and if all parties agree to use it, then the communication between them will become barrier-free.
The Internet is actually an architecture made up of ideas and protocols. Among them, the protocol is a set of well-known rules and standards, and if all parties agree to use it, then the communication between them will become barrier-free.
IP: delivers the packet to the destination host
If a packet is to be transmitted over the Internet, it must comply with the Internet Protocol (IP) standard. Different online devices on the Internet have a unique address, and the address is just a number, similar to most home pickup addresses. You only need to know the specific address of a home, and you can send a package to that address, so that the logistics system can deliver items to their destination.
The address of the computer is called the IP address, and visiting any website is really just your computer asking for information from another computer.
If you want to send a data host A to host B, the packet will be appended to host B's IP address information before transmission, so that it can be addressed correctly during transmission. In addition, the IP address of host An itself will be attached to the packet, and only with this information can host B reply the message to host A. This additional information is loaded into a data structure called the IP header. The IP header is the information at the beginning of the IP packet, including the IP version, source IP address, destination IP address, time to live, and so on.
Simplified three-layer Transmission Model of UDP Network
UDP: deliver packets to applications
IP is a very low-level protocol, which is only responsible for sending the data packet to the other computer, but the other computer does not know which program to send the data packet to. Should it be given to the browser or Arena of Valor? Therefore, it is necessary to develop protocols that can deal with applications based on IP, the most common of which is user packet Protocol (User Datagram Protocol), or UDP for short.
One of the most important information in UDP is the port number, which is actually a number, and every program that wants to access the network needs to bind a port number. The specified packet can be sent to the specified program through the port number UDP, so IP sends the packet to the specified computer through the IP address information, while UDP distributes the packet to the correct program through the port number. Like the IP header, the port number is loaded into the UDP header, and the UDP header is merged with the original packet to form a new UDP packet. In addition to the destination port, there is also information such as the source port number in the UDP header.
Simplified four-layer Transmission Model of UDP Network
UDP can not guarantee the reliability of data, but the transmission speed is very fast, so UDP will be used in some areas where speed is concerned, but data integrity is not so strict, such as online video, interactive games and so on.
TCP: complete delivery of data to the application
For applications such as browser requests or mail that require data transfer reliability (reliability), there are two problems with using UDP for transmission:
Packets are easy to be lost in the process of transmission; large files will be split into many small packets for transmission, these small packets will go through different routes and reach the receiver at different times, but the UDP protocol does not know how to assemble these packets, thus restoring these packets to complete files.
Based on these two problems, we introduce TCP. TCP (Transmission Control Protocol, Transmission Control Protocol) is a connection-oriented, reliable, byte-stream based transport layer communication protocol. Compared with UDP,TCP, it has the following two characteristics:
In the case of packet loss, TCP provides a retransmission mechanism; TCP introduces a packet sorting mechanism to ensure that disordered packets are combined into a complete file.
Like the UDP header, the TCP header not only contains the destination port and native port number, but also provides a sequence number for sorting so that the receiver can rearrange the packet by the sequence number.
Simplified four-layer Transmission Model of TCP Network
Let's take a look at the complete TCP connection process, through which you can see how TCP ensures the retransmission mechanism and packet ordering.
The life cycle of an TCP connection
As can be seen from the figure above, the life cycle of a complete TCP connection includes three stages: establishing the connection, transferring data, and closing the connection.
First, the connection phase is established. This phase is a "three-way handshake" to establish a connection between the client and the server. TCP provides connection-oriented communication transmission. Connection-oriented means to make preparations between the two ends before the start of data communication. The so-called three-way handshake means that when establishing a TCP connection, the client and server have to send a total of three packets to confirm the establishment of the connection. Secondly, the data transmission phase. At this stage, the receiver needs to acknowledge each packet, that is, after receiving the packet, the receiver needs to send an acknowledgement packet to the sender. Therefore, when the sender sends a packet and does not receive the confirmation message feedback from the receiver within a specified period of time, it is judged that the packet is lost and the retransmission mechanism of the sender is triggered. Similarly, a large file will be split into many small packets in the process of transmission. when these packets arrive at the receiver, the receiver will sort them according to the sequence number in the TCP header, so as to ensure that the complete data is composed. Finally, the disconnection phase. After the data transmission is complete, the connection will be terminated, involving the final stage of "four waves" to ensure that both sides can be disconnected.
In order to ensure the reliability of data transmission, TCP sacrifices the transmission speed of data packets, because "three-way handshake" and "packet verification mechanism" double the number of data packets in the process of transmission.
Original address: https://www.linuxprobe.com/ip-tcp-udp.html
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
File name: checkbox.htmlCheckbox Checkbox < / h4 >
© 2024 shulou.com SLNews company. All rights reserved.