Ma Zai Comics: How to "wave four times" to your girlfriend

Ma Zai Comics: How to "wave four times" to your girlfriend

[[357361]]

This article is reprinted from the WeChat public account "Ma Ge Dan", the author is Ma Zai. Please contact the WeChat public account "Ma Ge Dan" to reprint this article.

MSL is Maximum Segment Lifetime, the maximum survival time of a message. It is the longest time that any message can exist on the network. If it exceeds this time, the message will be discarded. Because TCP messages are based on the IP protocol, and there is a TTL field in the IP header, which is the maximum number of routes that an IP datagram can pass through. This value decreases by 1 for each router that processes it. When this value is 0, the datagram will be discarded, and an ICMP message will be sent to notify the source host.

The difference between MSL and TTL: The unit of MSL is time, while TTL is the number of routing hops. Therefore, MSL should be greater than or equal to the time when TTL is 0 to ensure that the message has been naturally destroyed.

TIME_WAIT waits for 2 times of MSL. A more reasonable explanation is that there may be data packets from the sender in the network. When these data packets from the sender are processed by the receiver, they will send a response to the other party, so it takes 2 times the time to wait for a round trip.

For example, if the passive closing party does not receive the last ACK message of the disconnection, it will trigger a timeout and resend the Fin message. After the other party receives the FIN, it will resend ACK to the passive closing party. The total time is exactly 2 MSLs.

The 2MSL time starts from the time the client sends ACK after receiving FIN. If the client receives a FIN message resent by the server during the TIME-WAIT time because the client's ACK is not transmitted to the server, the 2MSL time will be restarted.

In Linux, 2MSL defaults to 60 seconds, so 1MSL is 30 seconds. The Linux system stays in TIME_WAIT for a fixed 60 seconds.

Its name defined in the Linux kernel code is TCP_TIMEWAIT_LEN:

  1. #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME -WAIT
  2. state, about 60 seconds */

If you want to change the length of TIME_WAIT, you can only modify the value of TCP_TIMEWAIT_LEN in the Linux kernel code and recompile the Linux kernel.

The TIME-WAIT state is needed mainly for two reasons:

  • Prevent "old" packets with the same "quadruple" from being received;
  • Ensure that the "passive closing connection" party can be closed correctly, that is, ensure that the final ACK can be received by the passive closing party, so as to help it close normally;

<<:  When to use 5G and when to use Wi-Fi 6

>>:  What process resources are shared between threads?

Recommend

5G commercialization in its third year: a new prosperity

"As of the end of September, the total numbe...

Why does TCP need three handshakes and four waves?

[[402116]] This article is reprinted from the WeC...

Brief discussion: What is cloud network?

The future of cloud is bright. By 2024, more than...

Improve efficiency Essential tools on Mac

[[396744]] There are many useful software on Mac,...

With the advent of 5G networks, will 4G phones become obsolete? Not necessarily

The development of mobile phones has been very ra...

When will 5G transform the manufacturing industry?

5G not only offers faster connections and more ba...

Detailed explanation of five Docker container network modes

Docker networking sets up how containers communic...

Why SD-WAN is the best way to enable digital business

In a survey of mid-market enterprises, IDC found ...

Analysis of 5 promising 5G smart interconnection application industries

2019 saw the emergence of 5G commercial capabilit...