FIN_WAIT1的含义是什么?

时间:2011-05-06 10:56:35

标签: linux netstat

当我从Windows7 / Vista向Linux Red Hat 4发送HTTPS请求时,'netstat -an'命令显示 'FIN_WAIT1'或'SYNC_RECV'状态。

任何人都可以帮助我为什么会出现这些状态而不是ESTABLISHED?

2 个答案:

答案 0 :(得分:3)

TCP连接正在关闭,请参阅http://www.freesoft.org/CIE/Course/Section4/11.htm

答案 1 :(得分:0)

FIN_WAIT1是什么意思?: TCP连接正在关闭

我有一个Python示例显示流程:

  1. 我让服务器监听连接:
>>> import sys, socket
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sock.bind(('172.31.35.6', 6677))
>>> sock.listen()
>>> conn, client_address = sock.accept()
  1. 我将客户端连接到服务器
>>> import sys, socket
>>> conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> conn.connect(('3.19.54.89', 6677))
  1. 已建立连接
root@ip-172-31-35-6:/home/ubuntu# netstat | grep 6677
tcp        0      0 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:54944 ESTABLISHED
  1. 在关闭连接时记录netstat状态:
root@ip-172-31-35-6:/home/ubuntu# while true; do netstat | grep 6677; done > ~/tmp
  1. 关闭连接
>>> conn.close()
  1. 查看在步骤4中创建的netstat日志:
tcp        0      0 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 ESTABLISHED
tcp        0      0 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 ESTABLISHED
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      1 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT1  
tcp        0      0 ip-172-31-35-6.us-:6677 cpea84e3ff37803-c:55037 FIN_WAIT2