In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "how to understand the three-way handshake and four waves of TCP/IP". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Tcp/ip architecture: OSI seven-tier model, TCP/IP four-tier model, five-tier architecture
TCP is a connection-oriented, reliable protocol with low efficiency (byte stream)
UDP protocol is connectionless, unreliable and efficient (message).
TCP three-way handshake (ensure reliable transmission)
Three-way handshake:
The client first sends a connection message to the server (SYN=1,seq=x (random serial number))
After receiving the request, the server sends back the message (SYN=1,seq=y,ACK=1,ack=x+1) to the client.
After receiving the reply, the client finally informs the server (ACK=1,ack=y+1) that the connection is successful at this time.
Why not two handshakes?
The third handshake is to let the client confirm whether the response returned by the server is correct, and if not, the connection will not be established.
If a connection is established during the second handshake, unnecessary server overhead due to network delay cannot be avoided, and a new connection will be established every time a message comes.
Waving four times
The client sends a disconnected message to the server (FIN=1,seq=x (growth serial number))
After receiving the request, the server may still have data on hand to process, so reply the confirmation message to the client (ACK=1,ack=x+1) first.
After the server processes the data, it notifies the client to disconnect (FIN=1,seq=y). At this time, the server stops sending data and keeps receiving.
After receiving the response, the client informs the server (ACK=1,ack=y+1) that the client is closed after waiting for 2MSL, and disconnects at this time.
Why not wave three times?
When releasing a connection, the server is very passive. A sudden request from the client to release the connection cannot be released immediately, but returns first.
Acknowledge the message, wait for the data to be processed, and then return the response to release the connection. Compared with the three-way handshake, the server has one more step in response.
Why wait for 2MSL?
MSL is the maximum lifetime of a TCP message during transmission. If the server does not receive an acknowledgement message from the client in the 1MSL, it will send a request to the client to agree to shut down again.
The client waits for the 2MSL to shut down, but does not receive a request from the server during this period, indicating that the server has shut down normally.
How to ensure reliable transmission
The application data is divided into blocks that TCP considers most suitable for transmission.
Timeout retransmission: when TCP sends out a segment, it starts a timer and waits for the destination to acknowledge receipt of the segment. If a confirmation is not received in time, the message will be re-sent.
TCP numbers each packet sent, and the receiver sorts the packets and transmits the ordered data to the application layer.
Checksum: TCP will maintain its header and data checksum. This is an end-to-end checksum designed to detect any changes in the data during transmission. If there is an error in the inspection of the received paragraph, TCP will discard the message paragraph and do not acknowledge receipt of the message paragraph.
The receiver of the TCP discards duplicate data.
Flow control: each side of the TCP connection has a fixed buffer space, and the receiver of the TCP only allows the sender to send the data that can be accepted by the receiver buffer. When the receiver does not have time to process the sender's data, it can prompt the sender to reduce the transmission rate and prevent packet loss. The flow control protocol used by TCP is a variable size sliding window protocol.
Congestion control: reduce the transmission of data when the network is congested.
This is the end of the content of "how to understand TCP/IP three-way handshake and four waves". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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
© 2024 shulou.com SLNews company. All rights reserved.