[socket]尴尬的close_wait状态以及应对策略([socket] awkward close_wait status and coping strategies).docVIP
- 36
- 0
- 约1.2万字
- 约 15页
- 2017-09-03 发布于河南
- 举报
[socket]尴尬的close_wait状态以及应对策略([socket] awkward close_wait status and coping strategies)
[socket]尴尬的close_wait状态以及应对策略([socket] awkward close_wait status and coping strategies)
[Socket] awkward CLOSE_WAIT status and coping strategies
Writers
Edition
This article assumes that you are familiar with the Socket, C++, and TCP states.
Zheng Yun @ Linktone
First draft
Chapter content
The reason for the generation of the CLOSE_WAIT state
Reuse local addresses and ports
Calm down or force off?
summary
Abstract: This article explains why the socket connection is locked in the CLOSE_WAIT state and by what measures to avoid this situation.
Not long ago, my Socket Client program ran into a very embarrassing error. It should have continued to send data to the server on a socket long connection. If the socket connection is broken, the program will automatically retry the connection.
One day, discovery programs are constantly trying to build connections, but they always fail. Check with netstat, the program has thousands of socket connections, in the CLOSE_WAIT state, so that reached the upper limit, so can not establish a new socket connection.
Why is that so?
Why are they all in the CLOSE_WAIT state?
The reason for the generation of the CLOSE_WAIT state
First of all, we know that if our Client program is in the CLOSE_WAIT state, it will indicate that the socket is passively closed!
Because if the Server side is actively breaking the current connection, then the two sides shut down the TCP connection, a total of four packet:
Server FIN Client
Server ACK Client
At this point, the Server side is in the FIN_WAIT_2 state; and our program is in the CLOSE_WAIT state.
Server FIN Client
At this point, Client sends FIN to Server, and Client to the LAST_ACK state.
Server ACK Client
Server responds to ACK, and then the Client socket is really in the CLOSED state.
Our program is in the CLOSE_WAIT state, rather than LAST_ACK, indicating that no FIN to Server, it may be in close connection before there are a lot of data to be sent or other things to do, cause not the FIN pa
您可能关注的文档
- java内存(Java Memory).doc
- java中的堆栈详解(Detailed description of stack in Java).doc
- java在软件开发中可能出现的几个错误观点(Several misconceptions that Java may have in software development).doc
- java基础知识上课笔记(Java basics, class notes).doc
- java框架报错的解决方案(Java frame error solution).doc
- java对世界各个时区(timezone)的通用转换处理方法(Java general conversion processing method for each time zone (timezone) of the world).doc
- java读写追加删除xml节点(Java reads, writes, appends, and deletes XML nodes).doc
- java虚拟机的内存设置(Memory settings for the Java virtual machine).doc
- it职场求生法则(加强版)(It law of survival in the workplace (enhanced version)).doc
- jdbc学习笔记——jdbc性能优化-by jon(JDBC learning notes - JDBC performance tuning, -by, Jon).doc
最近下载
- 2025年河北省中考数学真题.docx VIP
- 6.3.2 世界上最大的黄土堆积区—黄土高原(第2课时2023-2024学年八年级下册地理精品教学课件(人教版)+.pptx VIP
- 安源光伏特玻璃厂带式输送机投标书.doc VIP
- 压缩热再生吸附式干燥机.ppt VIP
- 中医执业医师中医基础试题(一)(中医执业医师中医基础考试卷).doc VIP
- 中医执业医师考试中医基础模拟试题(2)(中医执业医师中医基础考试卷).doc VIP
- 吊耳计算对照表.pdf VIP
- 香港中医执业医师考试试题题库.pdf
- 高中语文选择性必修上课本原文、翻译.pdf VIP
- SY_T6592-2016固井质量评价方法.docx VIP
原创力文档

文档评论(0)