gpt4 book ai didi

sockets - 当 FIN-WAIT-2 时间用完时,主动关闭器将进入什么状态?

转载 作者:可可西里 更新时间:2023-11-01 02:54:29 25 4
gpt4 key购买 nike

当FIN_WAIT2时间用完,最后一个FIN还没有从另一边传来时,active closer的下一个状态是什么? TIME-WAITCLOSED ?

我们知道在linux系统中,可以在文件/proc/sys/net/ipv4/tcp_fin_timeout: man tcp(7)中设置FIN-WAIT-2

  • tcp_fin_timeout (integer; default: 60; since Linux 2.2)

    This specifies how many seconds to wait for a final FIN packet before the socket is forcibly closed. This is strictly a violation of the TCP specification, but required to prevent denial-of-service attacks. In Linux 2.2, the default value was 180.

  • TCP_LINGER2(自 Linux 2.4 起)

    The lifetime of orphaned FIN_WAIT2 state sockets.This option can be used to override the system-wide setting in the file /proc/sys/net/ipv4/tcp_fin_timeout for this socket. This is not to be confused with the socket(7) level option SO_LINGER. This option should not be used in code intended to be portable.

我不太确定这个 TCP 套接字在 FIN_WAIT2 时间用完后会进入什么状态,强行关闭,转移到关闭?或者只是跳入 TIME-WAIT 状态?

我做了一个测试:

1 : echo 3 > /proc/sys/net/ipv4/tcp_fin_timeout

2 : benchmark the tomcat runs on the linux

原来在netstat中出现了很多TIME-WAIT,而且还在不断累积,是不是意味着FIN_WAIT2时间用完了,套接字跳入TIME-WAIT?

还有一个问题:我改变了这个:echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse 正如其他人所说:“重用套接字”,并保持 tcp_fin_timeout:3。但什么都没有改变,TIME-WAIT 只是在累积。 tcp_tw_reuse与处于TIME-WAIT状态的套接字无关,TIME-WAIT套接字不能被重用?

echo 1 >/proc/sys/net/ipv4/tcp_tw_recycle 似乎可以减少TIME-WAIT 计数,并保持低水平,留下单独的负载平衡问题。

最佳答案

如果您查看 TCP/IP state diagram , FIN_WAIT_2 转换为 TIME_WAIT。所以我想当 FIN_WAIT_2 超时而 FIN 没有到达时,Linux 会简单地转换。

关于sockets - 当 FIN-WAIT-2 时间用完时,主动关闭器将进入什么状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25621622/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com