[What has been resolved is the heartbeat packet?

[What has been resolved is the heartbeat packet?


Author: Day Analysis

Author E-mail: [email protected]

Published: Mon, 29 Jul 2019 09:09:00 +0800

Often see a small (who had just entered the industry) asked me, what is the heartbeat packet, doing use?

1

Heartbeat is between the client and the server notifies the timing of a command word other defined their own state, a certain time interval according to the transmission, similar to the heart, so called heartbeat packet.
Excerpt Source: Zhang Qian's blog

Sockets

In fact, since the transmission data to the reception data in the network are using socket (sockets) is implemented, so they wander concept socket, the socket end is achieved at the transport layer communication, Therefore, when communication is performed, we need to consider this socket is available, that is, to determine whether the socket is disconnected, in order to maintain the establishment of communication without being interrupted, so there will be a heartbeat packet (because of similar beating of the heart and named), heartbeat packet belongs detection mechanism underlying TCP protocol.

The general process

In the TCP protocol, the support heartbeat mechanism, i.e. the SO_KEEPALIVE, default 2 hours detect a specific procedure is to each other send an ACK null packet after the other to close the package, connector everything is normal, an ACK is returned, if connection state is lost, the RST is returned, if not return any packet, no avail to try again sends an ACK, the connection is disconnected.

Guess you like

Origin www.cnblogs.com/anbus/p/11303718.html
Recommended