node2:/root/test#sysctl -w net.ipv4.tcp_fin_timeout="1"
net.ipv4.tcp_fin_timeout = 1
node2:/root/test#time python close1.py
Traceback (most recent call last):
File "close1.py", line 9, in <module>
s.recv(999)
socket.timeout: timed out
real 0m10.042s
user 0m0.019s
sys 0m0.010s
tcp_fin_timeout:这个参数表示当服务器主动关闭连接时,socket保持在FIN-WAIT-2状 态的最大时间。