First, write in the front
Hello everyone, we meet again, as an amateur animator, the last time to explain the TCP three-way handshake process in the form of animation and then received the majority of readers love, said the article interesting, goods, content, also received a lot of readers’ attention. Many readers left comments asking when to animate the TCP four waves. In response to your request, today we will animate the TCP four waves to share the TCP four waves.
Animation: Explain the TCP three-way handshake to the interviewer using animation
Last time the three handshake animation is for the interviewer to see, so today let’s change a more fun way, with your female (male) friends to explain the TCP four break up process, explain, test your female (male) friends and do not break up with you. What? First of all, you have a girl (boy) friend, which the deer has taken into account all the singles.
Obtaining method:
If you do not have a girlfriend, the public number background reply “girlfriend”, you can obtain. Deer shameless said, as an excellent animator, female readers are also a lot of, ha ha, the public number reply “boyfriend”, deer will give you a random issue, hey hey, don’t believe you try. What are you waiting for? Get your girl (boy) friend over and tell her (him).
Mind mapping
3. Why TCP three handshakes/four breakups?
TCP three handshakes and four breakups is exactly the same as you falling in love, from meeting, falling in love, breaking up, meeting another girl and repeating the process is the data transfer that sets up the three handshakes and four breakups over the network.
Love is love, break up is break up, shake hands, wave back and forth is not too much trouble?
Because the explanation of TCP three-way handshake in the last article was not very detailed, Little deer collected some information after class and made a summary, which is supplemented here.
3.1 Why three handshakes?
In The fourth edition of Computer Network written by Xie Xiren, the purpose of “three-way handshake” is “to prevent the invalid connection request message segment from being suddenly transmitted to the server, resulting in errors”.
An easy-to-understand example is when you confess your love to a girl on wechat and the message is delayed due to network problems.
The purpose of the three-way handshake, described in Computer Networks, is to solve the problem of “delayed repeated grouping in networks”.
3.2 Why does TCP break up four times?
As we know, TCP is a connection-oriented, reliable, byte stream based transport-layer communication protocol, and TCP is in full duplex mode.
For starters, definition is too boring, boring, actually means to you and your girlfriend chat is a connection-oriented, only together can communication, reliable guarantee is the information you send can send to each other, full duplex means not only can you send a message to your girlfriend, and she can also send information to you.
Why do you have to do four TCP breakups? We continue from last time, you are now in love with the second girl, and suddenly one day you find that the first girl missed the opportunity because she did not receive your confession, so you want to break up with the second girl, how does the process correspond to the four times of breaking up in TCP?
You want to send a message to the second girl’s wechat, we break up, at this time the second girl received the message to know, very sad, they blocked you. But, at this point, you haven’t blocked her, she’s perfectly free to continue messaging you, she’s sending you a message saying, ok, at this point you’ve received confirmation, and at this point it’s the second breakup process. So girls send you messages, cheating men who play with women’s feelings, never come to me. At this time you received the message, see the message after sending a goodbye, and then you directly shield the other party, at this time the girl’s wechat shows that you deleted the other party, and then you are also blocked and deleted. So that’s four breakups. Congratulations, you got your next girl.
The above procedure explains why you do TCP four breakups, in order to get the other person to block you until they delete each other, and then you can shake the other girl’s hand three times.
TCP four times break up process
Initialization state: The client and server are both in the connection state, and the next four breakups are performed.
- First breakup: The first breakup can be initiated by either the client or the server, because TCP is full-duplex.
If the client has finished sending data, send FIN = 1 to the server to tell the client that all data has been sent. You can close the server, but if you have data to send to the client, the client can still receive it. The client is in the FIN = 1 state and waits for the server to confirm releasing the connection.
- Second break up: After receiving the release request from the client, the server knows that the client has no data to send to it. Then the server sends ACK = 1 to tell the client that it has received the message you sent to me, and the server is in CLOSE_WAIT state.
- Third break: the server sends all data to the client, and then sends a FIN = 1 to tell the client that all data has been sent to the server. The client can also close the connection to receive data. The server is in the LAT_ACK state, waiting to confirm whether the client has received its request.
- Fourth break up: At this point, if the client receives the message sent by the server, it sends ACK = 1 to tell the server that the client has received your message. However, we find that there is a delay of 2 MSL in the figure above.
Why should there be 2 MSL wait delay?
In this case, the ACK = 1 sent by the client to the server is lost and the server does not receive it. What does the server think? I have sent the data, why didn’t the client respond to me? Did it get lost along the way? The server then initiates the disconnection request again. A return is 2MSL. What are the two returns here made up of?
The ACK = 1 sent by the client to the server is lost, and the server waits for 1MSL to not receive it, and then resends the message for 1MSL. If a message is received from the server again, the 2MSL timer restarts and a confirmation request is sent. The client only needs to wait for 2MSL. If it does not receive a message from the server again, it indicates that the server has received its own confirmation message. When both parties close the connection, TCP breaks up for four times.
Vi. What if the two parties establish a connection and one party has problems?
What if both sides establish a connection and one side has a problem? In order to prevent the above love story once in a thousand years, the connection has been established, but the server is waiting to receive, the sender has a problem and cannot send.
So design a timer to keep alive, and if one party has a problem and the other party has passed the timer, send trial messages, and then send them every 75 seconds. If there is no response after 10 probe packets are sent, the server assumes that the client is faulty and closes the connection.
summary
Today, in the form of animation to your female (male) friends told the TCP four break up process, the content of the article and show the form is the most basic content.
Finally, the deer sorted out the whole picture of the three handshakes and four breakups as follows:
Finally, I hope you and your girlfriend will never shake hands three times and never break up four times.
❤️ Don’t forget to leave your learning footprints[Likes + Favorites + comments]
After reading the article, why not give it a thumbs up? Hee hee, that shows you are very selfish, you are afraid of so good articles let others also see. Just a little joke.
In fact, I am also very selfish, I have always insisted on the original public account: “Deer animation learning programming” secretly to you, which gathered deer in the form of animation to explain data structure and algorithms, network principles, Web and other technical articles.
The author Info:
【 author 】 : Deer
[Original public account] Deer animation learning programming
[Introduction] : I learned programming from the ground up with Lu through animation, and presented the Web front-end field, data structure and algorithm, network principle and other easy-to-understand to my friends. Public reply “information” to send a from zero self-study information package!
[reproduced description] : reproduced please explain the source, thank you for your cooperation! ~