tcp连接close过程

来源:互联网 发布:手机正装照软件 编辑:程序博客网 时间:2024/06/05 09:10
active passive
TCP_FIN_WAIT1 -------FIN------->
TCP_FIN_WAIT2 <------ACK--------TCP_CLOSE_WAIT
 <------DATA-------
 <------FIN--------TCP_LAST_ACK
TCP_TIME_WAIT --------ACK------->TCP_CLOSE
|
|2MSL
   \|/
   TCP_CLOSE


其中:主动发起fin的一端的TCP_TIME_WAIT状态中,可以发给passive的ACK丢失,会重发,但是2MSL时间后,强行进入TCP_CLOSE
 如果在TCP_FIN_WAIT1阶段收到对端发送的FIN信号,则双方都进入TCP_CLOSING
 
active passive
TCP_FIN_WAIT1 -------FIN------->
TCP_CLOSING   <-------FIN-------- TCP_FIN_WAIT1
|
  \|/
TCP_CLOSING

TCP_TIME_WAIT --------ACK------->
 <-------ACK-------   TCP_TIME_WAIT
|                                  |
|2MSL   | 2MSL
   \|/  \|/
   TCP_CLOSE  TCP_CLOSE
原创粉丝点击