Time-Wait Status

Source: Internet
Author: User

Reprinted: http://blog.csdn.net/chensichensi/article/details/5263132

Time-Wait Status

  1. Only one Party that initiates an active shutdown enters this status. The exception is that both parties close the service at the same time.
  2. In this state, the stay time is 2msl, MSL is defined as 30 seconds to 2 minutes, Linux is defined as 30 seconds, so stay for 1 minute
  3. If data reaches this status, reset the timer.

In the Time-Wait Status, the connection is closed by the other party, and no data will arrive.

The following describes the necessity of Time-wait:

  1. For the active closing party, an ACK should be sent to the other party to confirm the closing. This ACK packet may be lost, so you can set a wait time. If the other party retransmits the FIN packet, you can also confirm it by sending the ACK packet;
  2. Due to network latency, some data packets may arrive after they are re-transmitted. In this case, if the connection is closed and both parties establish a connection with the same address, the data packet may be considered as the data packet for this connection. With time-Wait, the old connection exists when the data packet disappears from the network, so it will not interfere with the new connection described above.

Time-Wait accident (forced end of time not reached)

In rfc793, when the connection is in the Time-Wait status, if the RST message is received, TCP should immediately close the connection.

Rfc1337 describes this problem. The solution for Linux is to ignore this rst if rfc1337 is enabled,

Otherwise, the connection is closed.

If (Th-> RST ){
/* This is time_wait assassination, in two flavors.
* Oh well... nobody has a sufficient solution to this
* Protocol bug yet.
*/
If (sysctl_tcp_rfc1337 = 0 ){
Kill:
Inet_twsk_deschedule (TW, & tcp_death_row );
Inet_twsk_put (TW );
Return tcp_tw_success;
}
}

 

Another scenario occurs manually. For the so_linger socket option, if you enable linger and set

If the linger time is 0, the RST returns the time-Wait Status. Therefore, this option cannot be set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.