开发者

What does FIN_WAIT1 mean?

开发者 https://www.devze.com 2023-03-03 02:42 出处:网络
When I send a HTTPS request from Windows7/Vista to Linux Red Hat 4 the netstat -an <my_ip> command shows 开发者_C百科FIN_WAIT1 OR SYNC_RECV status.

When I send a HTTPS request from Windows7/Vista to Linux Red Hat 4 the netstat -an <my_ip> command shows 开发者_C百科FIN_WAIT1 OR SYNC_RECV status.

Why do these statuses appear instead of ESTABLISHED?


The TCP connection is closing, see http://www.freesoft.org/CIE/Course/Section4/11.htm


What does FIN_WAIT1 mean?: The TCP connection is closing

I have a Python example to show the flow:

  1. I put my server to listen for connections:
>>> 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. I connect the client to the server
>>> import sys, socket
>>> conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> conn.connect(('3.19.54.89', 6677))
  1. Connection is ESTABLISHED
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. Log the netstat status while closing the connection:
root@ip-172-31-35-6:/home/ubuntu# while true; do netstat | grep 6677; done > ~/tmp
  1. Close the connection
>>> conn.close()
  1. Look at the netstat log created in step 4:
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 
0

精彩评论

暂无评论...
验证码 换一张
取 消