How much do you know about the TCP/IP protocol? (one)

One: What is the main function of the transport layer?
 Split and reassemble the data stream provided by the upper layer to provide end-to-end transmission services for the data stream.

 

Two: How does the transport layer distinguish the data streams of different applications?
Because, for the transport layer, it only needs to know which service program on the target host responds to this program, and does not need to know what this service program does. Therefore, we only need to be able to abstract these applications and service programs. We use port numbers to abstractly identify each network program.
The TCP and UDP of the transport layer can receive data streams from multiple applications, identify them with port numbers, and then send them to the Internet layer for processing; at the
same time, TCP and UDP receive data packets from the Internet layer and distinguish them with port numbers. Then hand over to a different application.
So: different port numbers on the same IP address (same target host) are two different links. IP addresses and port numbers are used to uniquely determine the destination of data on the network.

 

Three: What protocols are there in the transport layer?
The two major protocols of the transport layer: TCP (Transmission Control Protocol) UDP (User Datagram Protocol)
TCP is a reliable link-oriented protocol, and UDP is an unreliable or connectionless protocol.
This relationship can be illustrated by calling and sending text messages:
UDP is like sending a text message, just send it out, and don’t care whether the other party is empty (the network is unreachable) or whether it can be received (packet loss).
TCP seems to be making a call, and both parties want to talk. First, it is necessary to make sure that the other party is not turned on (the network can be reached), and then to determine whether there is no signal, and then the other party needs to answer (communication link).

There is a request in the TCP protocol, and there will definitely be a response

 

Four: What is the UDP protocol?
The UDP packet structure is shown in the figure below:
source port (16)
destination port (16)
message length (16)
checksum (16)
data (variable)
UDP provides applications with an unreliable, connectionless Therefore, UDP packets may have problems such as loss, out-of-order, duplication, and delay.
Because it doesn't provide reliability, it has very little overhead.

Five: What is the TCP protocol?
 Transmission Control Protocol TCP is a link-oriented, reliable communication protocol.
1. Before starting the transmission, a three-way handshake is required to establish the link
. 2. Reliability: During the transmission process, the protocol modules of both parties continue to communicate
. 3. After the communication ends, both parties will use the improved three-way handshake to close the link.

 

Six: The overhead of UDP is very small. What does it mean?
1. Because UDP is connectionless. There is no need for a complex three-way handshake to establish a connection before transferring data.
2. When transmitting data, there is no inter-protocol communication traffic (confirmation signal), and there is no need to waste unnecessary processing time (receive the confirmation signal and send it again).
3; After the transmission is over, there is no need to use the improved three-way handshake for port connection.

 

Seven: Which environments is UDP suitable for? What environment is TCP suitable for?
Suitable environment for UDP: 1. In an efficient and reliable network environment (no need to consider the problems of packet loss, disorder, delay, duplication, etc. caused by poor network), because UDP is a connectionless service, there is no need to consume unnecessary Network resources (inter-protocol communication in TCP) and processing time (the time it takes for an expected acknowledgment) to be much more efficient. 2. In light-weight communication, when the amount of data to be transmitted is small (can be packed in an IP packet). If we use the TCP protocol, then, to establish a connection first, a total of 3 IP packets need to be sent, then data transmission, 1 IP packet, an IP packet that generates an acknowledgement signal, and then the connection is closed, 5 IP packets need to be transmitted . The utilization rate of IP packets using the TCP protocol is 1/10. With UDP, only one IP packet needs to be sent. Even if the packet is lost (the service is unsuccessful), the service can be re-applied (retransmission).

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326800075&siteId=291194637