It's the golden March and April again, and I'm a little eager to prepare for an interview to test my work level, so I started to modify my resume and prepare for an interview. As a result, I encountered a Waterloo in the first interview and ended up with a cold end. Why? The interviewer started to criticize the protocol, HTTP protocol, TCP/IP protocol, SSL protocol, MQTT protocol, anyway, all kinds of criticism, so I had to take a good look at the content of these protocols. Today, I will analyze the TCP protocol for you. What is TCP/IPTCP/IP protocol, Chinese name Transmission Control Protocol, refers to a protocol suite that can realize information transmission between multiple different networks. If you think that TCP/IP protocol only refers to TCP and IP, then I have to explain to you that TCP/IP protocol not only refers to TCP and IP protocols, but refers to a protocol cluster composed of FTP, SMTP, TCP, UDP, IP and other protocols. It is called TCP/IP protocol just because TCP protocol and IP protocol are the most representative in TCP/IP protocol. In other words, the TCP/IP protocol is composed of many things, not just TCP and IP. Composition of TCP/IP protocolAfen has put the picture above for everyone. In fact, the picture has already drawn the layering of the TCP protocol for everyone. In fact, the TCP/IP transmission protocol is strictly speaking a four-layer architecture, which includes the application layer, transport layer, network layer and data link layer. According to the classification of the OSI reference model, many people call it seven layers, and different layers correspond to different contents. In fact, the application layer, presentation layer, and session layer in the OSI seven-layer model all correspond to the application layer in the four-layer model. Because the services provided by the application layer, presentation layer, and session layer are not very different, they are all merged. The data link layer and the physical layer both belong to the network interface layer, also known as the link layer. This is because the content of the data link layer and the physical layer is almost the same, so in the TCP/IP protocol they are merged into the network interface layer (link layer) at one level. Introduction to TCP/IP protocol layeringSince there are four layers in total, let's introduce what these four layers represent and their main functions. From top to bottom: 1. Application layerThe application layer is the first layer of the TCP/IP protocol and directly provides services for the application process.
2. Transport layerThe transport layer is also called the transmission layer. In fact, it provides logical communication between processes. The transport layer shields the core details of the network layer below from high-level users, making the application appear to have an end-to-end logical communication channel between two transport layer entities. The transport layer consists of two parts of the protocol:
Both are used for communication between programs, but UDP is not as reliable as TCP. UDP only does the minimum work that a transport protocol can do. Apart from multiplexing/decomposition functions and a few error checks, it adds almost nothing else to IP. Since TCP is reliable compared to UDP protocol, why is it reliable? TCP reliability comes from:
The unreliable factors of UDP are:
Since UDP is unreliable, why do people still use it? In fact, there are several main reasons: First, the UDP protocol is simple. When using the TCP protocol to transmit data, if a data segment is lost or the receiving end does not confirm a data segment, the sending end will resend the data segment. TCP resending data will cause transmission delays and duplicate data, reducing the user experience. Although the UDP protocol cannot guarantee the confirmation of the data transmission, it can prevent data loss (forcing an explanation of his low level makes me feel ashamed). In fact, this is the case. Because of the user experience, the result is that the message reliability can only be sacrificed. If it is lost, it is lost. For the sake of user experience, I don’t want it. Remember this method. It is absolutely not advisable when writing code. Second, UDP is suitable for real-time data transmission, such as voice and video communications, because even if one or two data packets are lost occasionally, it will not have much impact on the reception results. For example, the early QQ used the UDP protocol. 3. Network layerThe network layer is located at the third layer in the TCP/IP protocol. In the TCP/IP protocol, the network layer can establish and terminate network connections and find IP addresses. In fact, the network layer provides services for the transport layer, and the transmitted protocol data units are called data packets or packets. (1) Representatives of network layer protocols include: IP, IPX, RIP, OSPF, etc. Let's take the classic IP protocol as an example:
(2) IP address classification IP addresses are divided into five types according to different network IDs: Class A addresses, Class B addresses, Class C addresses, Class D addresses and Class E addresses.
Generally, these contents are the address value range of the IP protocol that we learned when we studied computer basics. The main functions of IP addresses are:
4. Network Interface LayerNetwork Interface Layer In the TCP/IP protocol, the network interface layer is located at layer 4. Since the network interface layer combines the physical layer and the data link layer, the network interface layer is not only the physical medium for transmitting data, but also provides an accurate line for the network layer. The network interface layer encapsulates the upper layer IP datagram into a frame at the sending end and sends it to the network; when the data frame reaches the receiving end through the network, the network interface layer of the node unpacks the data frame and checks the MAC address contained in the frame. If the address is the local MAC address or the broadcast address, it is uploaded to the network layer, otherwise the frame is discarded. In fact, Afen thinks that the network interface layer is actually equivalent to the function of a network card, just like a data packet goes from one network card to another. In fact, these protocols often depend on personal understanding. Some people like to call them data link layer, and some people like to call them network interface layer. It can only be said that it is personal preference. When the interview comes, it will depend on your performance. |
Want to self-check and improve your cybersecurity...
[[394900]] China Mobile today released its main o...
At present, 5G is rapidly integrating into variou...
Edge computing means different things to differen...
edgeNAT is a Chinese VPS hosting company establis...
[[348593]] This article is reprinted from the WeC...
RackNerd announced the news of its new French dat...
Traditional perimeter-based network protection co...
【51CTO.com Quick Translation】Introduction: Changi...
"IO multiplexing" is a common technical...
The 5G standard is composed of many technologies,...
The wind disappears, but the tide moves. Septembe...
I wonder if you have noticed the names of wireles...
Labs Guide Before the emergence of WebSocket, the...
80VPS has newly launched the Hong Kong CI data ce...