What does FIN_WAIT1 mean?
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:
- 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()
- 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))
- 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
- Log the netstat status while closing the connection:
root@ip-172-31-35-6:/home/ubuntu# while true; do netstat | grep 6677; done > ~/tmp
- Close the connection
>>> conn.close()
- 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
精彩评论