Computer Network Test Center

Header tcp/udp

  1. tcp/udp protocol

tcp/udp is a transport layer protocol. It is a very commonly used network protocol.

Title 1.1 tcp/udp three handshake, four waves

TCP establishes a connection through a three-way handshake, and disconnects through four waves of hands. UDP is for connectionless and does not need to establish a connection.

Title 1.2 TCP flow control

The continuous ARQ protocol allows TCP frames to flow continuously within the size of the sliding window. The TCP flow is controlled by algorithms such as congestion window, congestion avoidance, and slow start.

Heading 1.3 Continuous timer

When the sender receives an ACK message with a window value of 0, it needs to start a timer to wait for the receiver to send another ACK message with a window size other than 0 (in TCP, messages that only contain confirmation information do not need to be confirmed and retransmitted) If there is no timer, both parties may be in a waiting state after the ACK message with a window other than 0 is lost. When the duration timer expires, the sender will send a special probe message to prompt the other party to retransmit one ACK message.

Title 1.4 Stop waiting protocol, ARQ protocol

The stop-and-wait protocol is a data link layer protocol. It stipulates that state variables and data frames can only be sent after the correct confirmation frame is received.
ARQ protocol (Automatic Repeat-reQuest) is an error correction protocol at the data link layer. Stop waiting for ARQ protocol and continuous ARQ protocol.
Stop waiting for ARQ protocol: Send a message each time, send the next message after confirmation, the sending window and receiving window are both 1, and stop waiting for ARQ requires a small buffer but low efficiency.
Continuous ARQ protocol: Back n frames of GBN and selective retransmission ARQ. It is a combination of sliding window and request retransmission technology. It can continuously send several information frames without waiting for the previous frame to be confirmed, which greatly improves the transmission efficiency However, the sender needs to set up a re-listing to store the frames to be confirmed, and delete the frames from the re-listing after receiving the confirmation frame, which requires more storage space.

Title 1.5 Sliding window, slow start, congestion avoidance, fast retransmission, fast recovery, reliability, sequential transmission, TCP BBR congestion algorithm

Sliding window: The sliding window protocol is a technique used to improve throughput by allowing the sender to transmit additional packets before receiving any response. The receiver tells the sender how many packets can be sent at a certain moment (called the window size).
Slow start: Set the congestion window value to 1, and the sender will increase the congestion window by 1 every time it receives an ACK until it reaches the congestion threshold (ssthresh, initial value is 16).
Congestion threshold (ssthresh): Congestion of the slow start algorithm Maximum window.
Congestion window (cwnd): Depends on the degree of network congestion and is constantly changing. As long as there is no congestion in the network, the sender will increase the congestion window, and as long as there is congestion, reduce it. Send The window is always smaller than the congestion window (smaller than the congestion window when the acceptance window is smaller).
Acceptance window (rwnd): The acceptor sets the acceptance window rwnd according to its own acceptance capability (cache limit), and writes it into the tcp header field.
Congestion Avoidance algorithm: Let the congestion window grow slowly, that is, increase the sender's congestion window cwnd by 1 instead of doubling each time a round trip time RTT passes. In this way, the congestion window grows slowly according to a linear law.
Fast Retransmit and Recovery: Can improve the throughput of the network. When the receiver receives an out-of-sequence data segment, it will immediately send a repeat to the transmitter Acknowledgement. If the sender receives three duplicate acknowledgments, it will assume that the data segment indicated by the acknowledgment is missing, and immediately retransmit these missing data segments. With FRR, there is no delay due to the pause required during retransmission. Without FRR, if the data packet is lost, TCP will use a timer to request a transmission pause.
Fast recovery algorithm: Used in conjunction with fast retransmission. When the sender receives three repeated acknowledgments in a row, it executes the multiplication reduction algorithm to halve the slow start threshold ssthresh. This is to prevent network congestion. Please note that the slow start algorithm will not be executed next. Since the sender now believes that there is no congestion in the network, it does not perform slow start but sets the cwnd value to the value after the slow start threshold ssthresh is halved, and then starts to execute the congestion avoidance algorithm, so that the congestion window is slowly increased linearly .
BBR congestion algorithm: Google’s TCP BBR algorithm optimizes TCP throughput.

Title 1.6 How to determine the size of the sliding window?

It is divided into receiving window and sending window. The value of the receiving window is determined according to the size of the buffer. The receiving party puts the receiving window size in the header of the TCP message. The sending method determines the size of the sending window according to the size of the receiving window and the congestion window (minimum). The size of the congestion window is limited by the network situation and is dynamically determined according to the transmission process.

Title 1.7 How do tcp and udp judge the client is closed?

Judging by the length of the received packet, if the length of the received packet is 0, it means that the client has disconnected.

Title 1.8 What is the difference between tcp and udp?

TCP is connection-oriented and reliable, while udp is connectionless and unreliable.

TCP guarantees the correctness and sequence of data. But udp does not guarantee. TCP is in stream mode, while UDP is in packet mode.

Title 1.9 Practical application scenarios of udp?

UDP packets are often used in scenarios that require high efficiency but relatively low accuracy. Such as live video, chat, etc.

Title 1.10 What is the status of time_wait? What does it do? Why continue 2 MSL?

time_wait: After tcp is connected, after the four-way handshake, the end that sends the FIN flag first will enter the time_wait state. It has two functions:

Make sure that the last acknowledgment message can arrive. If it does not arrive, the server will resend the FIN request and wait for a period of time without resending, indicating that the server has been CLOSED. If there is a retransmission, the client will resend the last ack message .
wait a period of time (2MSL), the connection process to ensure that all messages have disappeared from the network. makes new connections will not be the old connection request packet.

Header http protocol

2.1 http protocol status code (302, 404, 501)

302: The server currently responds to requests from webpages in different locations, but the requester should continue to use the original location for future requests.
404: The server cannot find the requested webpage.
501: The server does not have the function to complete the request. For example, the client A PUT request that the server does not support was sent
2.2 What is the http protocol stateless protocol?
Means that the protocol has no memory of transaction processing, and subsequent access requires the previous information, and the corresponding information must be retransmitted, which will increase the amount of data per connection. Currently, this problem is solved through cookies.

Heading 2.3 What are the request methods for http protocol?

GET、POST、DELETE、PUT、HEAD、OPTIONS.

Heading 2.4 The difference between GET and POST?

The size of GET data transmission is limited by the browser to 1024. POST is not limited. GET parameter transmission is written in the URL, and POST parameters are stored in the package body, which is more secure

Heading 2.5 http protocol header field?

Request method, URI, HTTP version, status code, etc.

Title 2.6 http protocol optimization?

Parallel connection: You can establish multiple tcp connection channels to achieve parallel transmission of data and improve the page response rate.
Long connection: HTTP/1.1 defaults to open the Keep-Alive option. And it is in pipeline mode. This can reuse TCP connections in multiple requests .
cache: cache-control to control the If-Modified-Since the cache is also about the cache, if the server is updated resource at a time, then the client should download the latest resources.

Title 2.7 What are the characteristics of the http protocol?

Support C/S mode.
Simple and fast: When a customer requests a service from the server, only the request method and path need to be transmitted.
Flexible: Any type of data format can be transmitted by setting the Content-type flag.
No connection: Only one is processed per connection Request.
Stateless: The http protocol is a stateless protocol.

Title 2.8 The difference between http and https?

https requires ca certificate, and it is likely that ca certificate needs to be charged.
https is for security, and http is added to the ssl layer. https transmits cipher text. The
connection method is different. The port is 80 and 443. The
http protocol is very simple, yes Stateless. And https can be authenticated through ssl, which is more secure.

Guess you like

Origin blog.csdn.net/aaaqqq1234/article/details/108418996