I couldn't help laughing when I saw these two pictures today. Many jokes or jokes on the Internet are actually the most funny ones that come from real life, not those made up for the sake of laughter.
Image from Baotu.com Will WeChat really cause information to be mixed up due to poor network conditions? It really will. Why? Ma Huateng said that WeChat is just an email address, but it is faster, so you don’t feel it is an email address, but give you the illusion of instant messaging. WeChat mailbox works like this: Alice logs in to WeChat server, authenticates her identity, and goes online. This is a long connection based on TCP, which is securely encrypted. The so-called persistent connection means that as long as Alice's phone is not out of power or turned off, this persistent connection is always running and bidirectional communication is possible. The server responsible for login is referred to as the login server. Alice sends a text message to Bob, "Are you kidding me?" and presses Enter. Is this text message sent through the long connection above? No. Instead, it is sent through a short connection, which is established when Alice clicks on Bob's profile picture. This is a short connection of TCP + MMTLS (secure encryption) + HTTP encapsulation. Then the message is sent via HTTP using a short connection. Is this message sent directly to Bob? No, it was sent to Bob's email address. Is Bob's email address in Bob's mobile phone or in the WeChat storage server? WeChat server. What are the benefits of doing this? If Bob is on a plane and his phone is turned off, Alice can still send the message. If she sends the message directly to Bob's phone, which is turned off, she will not be able to establish a connection and will not be able to send the message. Of course, there are many other benefits, for example, Alice and Bob's phones are both located behind NAT devices, and direct communication between them may not be 100% successful. If Bob is online, the login server will immediately notify Bob through a TCP persistent connection that there is a letter in his WeChat mailbox. As for where the letter is stored in the mailbox, this is a HTTP format link. Bob WeChat will establish a short link with the storage server corresponding to the link, download and display the message to the local window, and then close the short link. If Bob is offline, the WeChat server is not in a hurry, because the message will stay in the storage server and will not be sent. When Bob gets off the plane and comes online, WeChat will notify Bob as soon as possible. The above is the working process of WeChat. Next, let’s talk about why WeChat has the situation where the last message sent is the first to arrive. Every time WeChat finishes typing a paragraph and clicks "Send", this message is triggered once:
This is the standard three-step process. When you send a text message again, the three-step process is triggered again. The two three-step processes are independent of each other. When the network is smooth, Alice's first message is quickly sent to Bob's mailbox and displayed in Bob's WeChat window. Alice's second message is sent later, so it arrives later, which is very understandable. But when the network is not good, the first three-step message is not so lucky and is lost, and then Alice's phone keeps retransmitting the message. Alice then sends the second message, which is very lucky and is not lost. As a result, it arrives a few seconds earlier than the first message. Since WeChat emphasizes timely communication, WeChat will notify Bob's WeChat as soon as possible, but the order of message notification is the second message first, and then the first message. This causes the WeChat message sequence to be reversed. Finally, the text inside each message is not reversed, right? This is the credit of TCP, because short connections still use TCP as the transmission protocol, and what TCP is best at is ensuring that each byte arrives in order. TCP is a reliable protocol that can repair byte losses caused by temporary network interruptions. However, if Alice is uploading a message to Bob's mailbox and the network is interrupted for a long time, exceeding the maximum TCP repair time, WeChat will prompt Alice that the message has failed to be sent! Author: Che Xiaopang talks about the Internet Editor: Tao Jialong Source: Reprinted from the public account Che Xiaopang Talks Network (ID: chexiaopangnetwork) |
<<: Huawei's Hu Houkun: Make Hongmeng and Euler into important social resources
>>: 5G, IoT and AI: Art and tech jobs for 2021
At present, the digital economy is entering a new...
The launch of 5G isn’t all that far away, with ro...
Aruba, a subsidiary of Hewlett Packard Enterprise...
Blockchain has been talked about a lot recently. ...
The New Year is over, and Brother Song has been m...
5G is like an elephant running wildly in the wire...
Aruba, a subsidiary of Hewlett Packard Enterprise...
According to media reports, due to high investmen...
IPv6, which is "not fast enough to keep up w...
On August 20, 2019, Aruba, a subsidiary of Hewlet...
Life is the most important thing, and unity is st...
[Original article from 51CTO.com] Hello, my frien...
[[335436]] This article is reprinted from the WeC...
When we start learning network programming, we fi...
On January 16, China Mobile and Huawei successful...