CLOSE_WAIT problem
The reason is simple: TCP four waved issue, launched in FIN instruction
Details, your own Baidu
Note that, CLOSE_WAIT exist only after the connection has been successfully connected to the socket
Articles induced error
Under criticized: http://blog.huoding.com/2016/01/19/488
Specific summarized as follows:
Learn the server connection is successfully established in the process of behavior
Reference article:
- https://blog.csdn.net/alitech2017/article/details/80922902
- http://veithen.github.io/2014/01/01/how-tcp-backlog-works-in-linux.html
The above two articles the problem server-side connection process, as well as works backlog see very clearly
Here again simply repeat the procedure, see:
- Client (53302) sends a SYN instruction request to establish a connection
- The server (999) transmits SYN-ACK command, a response (socket to the sync queue)
- Client (53302) transmitting an ACK command, and that they have a connection completion
- After receiving the ACK command server (999), found that accept queue is full, the packet is discarded ACK
- The server (999) repeats
BackOff (退避算法)
, SYN-ACK transmission command - The server (999) has not received client ACK command, then eventually send RST command, closes the connection
The above process, the server side portions 5 do, the client does the following things:
- Client (53302) will begin sending data PSH-ACK (because the client considers the connection has been established successfully)
- Since then the server does not receive an ACK packet (999), the repeated
BackOff (退避算法)
transmission data PSH-ACK
The above figures do not another case, that the client after the connection is successfully established, data is not sent, then the server (999) will eventually send command RST, the connection is closed
Therefore, the server:
- Or receive ACK command sent by the client to complete the three-way handshake. accpet () function returns the socket object
- RST instruction is either transmitting end connection
FIG state socket
The following diagram taken from the network article, under the main Description: CLOSE_WAIT may only appear later in the ESTABLISHED state; and only receive instruction before transferring FIN
in conclusion
- TCP connection establishment, the server only sends a reset command RST is connected
- backlog values may only make a lot of connections can not connect to the server
- CLOSE_WAIT may only appear later in the ESTABLISHED state; and only receive instruction before transferring FIN
other
The article mentioned BackOff (退避算法)
, this may not be the TCP proper noun, a word to express a meaning, repeatedly sent the next time will be longer command