当前位置:网站首页>What would happen if disconnecting during the process of TCP connection?
What would happen if disconnecting during the process of TCP connection?
2022-08-10 22:31:00 【TABE_】
What happens if the network cable is unplugged during a TCP connection?
In response to this issue, it is necessary to discuss in different scenarios:
- After unplugging the network cable, there is data transmission;
- After unplugging the network cable, there is no data transmission;
Data transmission after unplugging the network cable
After the client unplugs the network cable, the data packet sent by the server to the client will not receive any response. After waiting for a certain period of time, The server will trigger a timeout retransmission mechanism, retransmit data packets that do not receive a response.
If the client just plugs the network cable back in while the server is retransmitting the message.Since unplugging the network cable does not change the TCP connection status of the client, and it is still in the ESTABLISHED state, the client can normally receive the data packet sent by the server, and then the client will return an ACK response packet.At this point, the TCP connection between the client and the server still exists, and it feels like nothing happened.
But if the client has not plugged the network cable back in the process of retransmitting the message from the server.When the number of times the server retransmits the message over time reaches a certain threshold, the kernel will determine that there is a problem with the TCP, and then tell the application that there is a problem with the TCP connection through the Socket interface, so the TCP connection on the server will be disconnected.After the client is plugged back into the network cable, if the client sends data to the server, since the server has no TCP connection with the same quadruple ancestor as the client, the server kernel willReply to the RST message, and the client will release the TCP connection after receiving it.At this point, both the client and server TCP connections have been disconnected.
No data transfer after unplugging the network cable
- If the TCP keepalive mechanism is not enabled by both parties, after the client unplugs the network cable, if the client does not plug in the network cable, the TCP connection state between the client and the server will always exist.
- If both parties have enabled the TCP keepalive mechanism, then after the client unplugs the network cable, if the client does not plug back the network cable, the TCP keepalive mechanism will detect that the other party's TCP connection is not alive, so it will disconnect the TCP connection.However, if the client plugs back the network cable during the TCP detection period, the original TCP connection between the two parties can still exist normally.
KeepAlive mechanism: When there is no data transmission in the connection for a period of time, TCP automatically sends a message with empty data to the other party. If the other party responds to this message, it means that the other party is still online and connected.It can continue to be maintained. If the other party does not return a message and retries many times, the connection is considered lost, and there is no need to maintain the connection.
边栏推荐
- Labelme-5.0.1 version edit polygon crash
- shell脚本
- Common interview questions for APP UI automation testing, maybe useful~
- “数据引擎”开启前装规模量产新赛道,「智协慧同」崭露头角
- ASCII、Unicode和UTF-8
- 阿里云新增三大高性能计算解决方案,助力生命科学行业快速发展
- What are the concepts, purposes, processes, and testing methods of interface testing?
- 字节跳动原来这么容易就能进去...
- 今日睡眠质量记录75分
- 深度学习之 12 循环神经网络RNN2
猜你喜欢
shell (text printing tool awk)
阿里云架构师金云龙:基于云XR平台的视觉计算应用部署
Shell programming specification and variables
Service - DNS forward and reverse domain name resolution service
Huawei router clock near the drainage experiment (using stream strategy)
ThreadLocal全面解析(一)
The Thread State,
阿里巴巴、蚂蚁集团推出分布式数据库 OceanBase 4.0,单机部署性能超 MySQL
IM 即时通讯开发如何设计图片文件的服务端存储架构
管理员必须知道的RADIUS认证服务器的部署成本
随机推荐
商家招募电商主播要考虑哪些内容
Live Classroom System 09--Tencent Cloud VOD Management Module (1)
The perfect alternative to domestic Gravatar avatars Cravatar
边缘与云计算:哪种解决方案更适合您的连接设备?
win系统下pytorch深度学习环境安装
2022.8.8 Selected Lectures on Good Topics (Number Theory Field)
元宇宙社交应用,靠什么吸引用户「为爱发电」?
《DevOps围炉夜话》- Pilot - CNCF开源DevOps项目DevStream简介 - feat. PMC成员胡涛
What are the concepts, purposes, processes, and testing methods of interface testing?
Extended Chinese Remainder Theorem
Exploration and practice of the "zero trust" protection and data security governance system of the ransomware virus of Meichuang Technology
交换机和生成树知识点
从斐波那契 - 谈及动态规划 - 优化
shell脚本循环语句for、while语句
深度学习之 12 循环神经网络RNN2
LeetCode每日两题02:反转字符串中的单词 (均1200道)
shell编程之正则表达式与文本处理器
电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)(Matlab代码实现)
LeetCode每日一题(1573. Number of Ways to Split a String)
geemap的详细安装步骤及环境配置