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狀 態的最大時間。