Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method for maintaining long connection by sending heartbeat packet

A heartbeat packet, long connection technology, applied in the field of communication, can solve the problems of performance waste and short heartbeat packet interval (less than 2 minutes, etc., to reduce the processing time of heartbeat packets and improve performance.

Active Publication Date: 2014-04-09
XIAMEN YUEXUN INFORMATION TECH CO LTD
View PDF4 Cites 15 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

If a single server has a large number (hundreds of thousands or millions) of long connections, and the heartbeat packet interval of each long connection is very short (less than 2 minutes), then the server will be very frequently between the kernel and the user space Switching, serious waste of performance

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for maintaining long connection by sending heartbeat packet
  • Method for maintaining long connection by sending heartbeat packet
  • Method for maintaining long connection by sending heartbeat packet

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0048] Such as figure 2 As shown, the keepAlive option of the TCP protocol proposed by the present invention is a function of the TCP protocol itself and belongs to the transport layer. When the server receives the keepAlive detection packet sent by the client, it can reply to the client at the transport layer, and will not go to the upper layer Submit, so the efficiency is much higher.

[0049] A method for sending heartbeat packets to maintain a long connection in the present invention comprises the following steps:

[0050] Step 1: Turn on the keepAlive switch and set the keepAlive parameters, including:

[0051] client:

[0052] Step A1: Establish a TCP Socket client;

[0053] Step A2: Turn on the SO_KEEPALIVE option;

[0054] Step A3: Set TCP_KEEPIDLE as the heartbeat packet interval period;

[0055] Step A4: Set TCP_KEEPINTVL to 5 seconds;

[0056] Step A5: Set TCP_KEEPCNT to 2 times;

[0057] Step A6: Start blocking read and write;

[0058] Server:

[0059] St...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

A method for maintaining the long connection by sending a heartbeat packet includes the steps that a keepAlive switch is turned on, keepAlive parameters are set, a keepAlive timer of a client TCP starts to work, and if no effective data transmission happens before time of the keepAlive timer is up, the client TCP stack working in a kernel space of the system automatically sends the keep-alivepacket to a server side. According to different network conditions, three processing procedures of normal conditions, network abnormity or server side abnormity and the condition that the server side is restarted after being interrupted occur. The method is achieved by regulating the keepAlive parameters of the TCP, the function that the keepAlive options of the TCP are used is the internal function of the TCP and belongs to a transmission layer, when a server receives the keepAlive explorer packet sent by the client side, the server can reply the client side on the transmission layer, the keepAlive explorer packet will not be submitted to the upper layer any more, and therefore the efficiency is improved greatly.

Description

technical field [0001] The invention relates to the communication field, in particular to a method for sending a heartbeat packet to maintain a long connection. Background technique [0002] The existing heartbeat packet technology is all sent by the application layer to the server, the server replies to the client after receiving the heartbeat packet data, the client receives the reply from the server to confirm that the connection is normal, and if it does not receive a normal reply from the server, it is judged that the connection is abnormally interrupted. The main disadvantage of this technique is that a lot of server resources are wasted, because the data needs to be copied from the network card cache space to the operating system kernel space, and then copied from the operating system kernel space to the user space, and the data returned by the server also needs to be copied from the user space to the operation The system kernel space, and then copied from the kernel ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/06
Inventor 严伯盛林飞达黄礼锋
Owner XIAMEN YUEXUN INFORMATION TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products