The invention relates to the technical field of
heartbeat packet control and especially relates to a
heartbeat packet asynchronous control method and apparatus. The
heartbeat packet asynchronous control method comprises the following steps: step A, performing
server socket communication parameter initialization and
server communication model initialization, and establishing a monitoring socket descriptor; step B, establishing and initializing a
server dynamic
list; step C, initializing and starting a
system timer controlling a heartbeat packet; and step D, invoking a monitoring function, determining whether a
client communication event is triggered, if so, a server main program exiting from the monitoring function, and the server traversing and
processing the communication event, and if not, continuously waiting until the
client communication event is triggered. According to the invention, by use of an
Epoll server model of a linux
system, the method and apparatus are simple, reliable and highly efficient, the problems of multithread
programming and protocol complexity are overcome,
system memory resources are fully utilized, heartbeat packet data is efficiently processed.