TCP建立和释放

握手

TCP连接状态

三次握手

在这里插入图片描述
下面是状态的解释:

StateDescription
LISTENThe socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listening (-l) or --all (-a) option.
SYN_SENTThe socket is actively attempting to establish a connection.
SYN_RECVA connection request has been received from the network.
ESTABLISHEDThe socket has an established connection.
四次释放

在这里插入图片描述
上面的网图看着还是挺清晰的,但是有个小瑕疵,就是不应该是客户端对服务端,而是主动关闭端对应被动关闭端。主动关闭端要求进入TIME_WAIT 状态。

下面是各种状态的解释:

StateDescription
ESTABLISHEDThe socket has an established connection.
FIN_WAIT1The socket is closed, and the connection is shutting down.
FIN_WAIT2Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAITThe socket is waiting after close to handle packets still in the network.
CLOSEThe socket is not being used.
CLOSE_WAITThe remote end has shut down, waiting for the socket to close.
LAST_ACKThe remote end has shut down, and the socket is closed. Waiting for acknowledgement.
CLOSINGBoth sockets are shut down but we still don’t have all our data sent.
TIME_WAIT重置场景

主动端关闭连接之后,被动端发送了FIN报文代表被动端也想要关闭连接。此时,主动端发送的确认报文失效。

被动端没有收到FIN的确认报文,因此重发FIN报文,主动端收到会重置时钟,发送ACK确认报文。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值