CN107276859A - Keep the method and device of long connection - Google Patents
Keep the method and device of long connection Download PDFInfo
- Publication number
- CN107276859A CN107276859A CN201710720362.1A CN201710720362A CN107276859A CN 107276859 A CN107276859 A CN 107276859A CN 201710720362 A CN201710720362 A CN 201710720362A CN 107276859 A CN107276859 A CN 107276859A
- Authority
- CN
- China
- Prior art keywords
- service terminal
- time interval
- heartbeat packet
- time
- terminal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/143—Termination or inactivation of sessions, e.g. event-controlled end of session
- H04L67/145—Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/10—Active monitoring, e.g. heartbeat, ping or trace-route
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/535—Tracking the activity of the user
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W52/00—Power management, e.g. TPC [Transmission Power Control], power saving or power classes
- H04W52/02—Power saving arrangements
- H04W52/0209—Power saving arrangements in terminal devices
- H04W52/0225—Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
- H04W52/0248—Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal dependent on the time of the day, e.g. according to expected transmission activity
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Cardiology (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The present embodiments relate to Internet technical field, it is specifically related to a kind of to keep the long method and device connected, the method of holding length connection includes the response bag for receiving the heartbeat packet progress response that the service terminal is sent to the client terminal, the response bag includes the performance parameter of the service terminal and the time of client terminal transmission heartbeat packet, according to current time, send the time of heartbeat packet and the performance parameter of the service terminal is calculated away from the time interval for sending next heartbeat packet, and then service terminal is wrapped according to the next heartbeat of time interval transmission, it is connected with being set up with service terminal.Because the time interval is calculated in real time according to the performance parameter of the service terminal, therefore, the pressure of service terminal is reduced, while avoiding client terminal constantly sends heartbeat packet, save the electricity and flow of client terminal, improve Consumer's Experience sense.
Description
Technical field
The present invention relates to Internet technical field, the long method and device connected is kept in particular to a kind of.
Background technology
Client is connected with needing holding client to be constantly in server during server progress message push
State.Traditional mode keeps client to be by way of client constantly sends heartbeat packet with the method that server length is connected
Come what is kept.It is that client opens a timer that heartbeat packet is sent in traditional approach, is given when every time to timer expiry
Server sends a heartbeat packet and exchanged with server progress primary information, by the heartbeat packet communication of this fixed cycle come really
The http connections protected between server and client will not disconnect.Maximum shortcoming is the consistency of heartbeat packet in traditional scheme,
When occurring that network delay is more than the time-out time of heartbeat packet when network signal is very poor, now it may result in many
The secondary possibility for sending heartbeat packet, so and wastes the traffic overhead of client and also has certain open to client electricity etc.
Pin.
Therefore it provides a kind of method of the long connection of new holding is very necessary, to realize the stream for saving client
Amount and electricity expense, while reducing the pressure of server.
The content of the invention
It is an object of the invention to provide a kind of method for keeping long connection, to realize the electricity expense for saving client terminal
And traffic overhead, while reducing the pressure of service terminal, improve Consumer's Experience sense.
Another object of the present invention is to provide a kind of device for keeping length to connect, to realize the electricity for saving client terminal
Expense and traffic overhead, while reducing the pressure of service terminal, improve Consumer's Experience sense.
To achieve these goals, the technical scheme that the embodiment of the present invention is used is as follows:
In a first aspect, the embodiments of the invention provide a kind of method for keeping long connection, applied to client terminal, the visitor
Family terminal is communicated to connect with service terminal, and methods described is used to keep the client terminal to be connected with the length of the service terminal,
Methods described includes:
Receive the response bag for the heartbeat packet progress response that the service terminal is sent to the client terminal, the response bag
Performance parameter and the client terminal including the service terminal send the time of heartbeat packet;
Calculate next away from sending according to the performance parameter of current time, the time of transmission heartbeat packet and the service terminal
The time interval of individual heartbeat packet;
Next heartbeat packet is sent to the service terminal according to the time interval.
Second aspect, the embodiment of the present invention additionally provides a kind of device for keeping length to connect, described applied to client terminal
Client is communicated to connect with service terminal, and described device is used to keep the client terminal to be connected with the length of the service terminal,
Described device includes:
Receiving module, the response of response is carried out for receiving the heartbeat packet that the service terminal is sent to the client terminal
Bag, the time for the heartbeat packet that the performance parameter and the client terminal that the response bag includes the service terminal are sent;
Computing module, for the performance parameter according to current time, the time of transmission heartbeat packet and the service terminal
Calculate away from the time interval for sending next heartbeat packet;
Sending module, for sending next heartbeat packet to the service terminal according to the time interval.
A kind of method and device for keeping length to connect provided in an embodiment of the present invention, the method and device of holding length connection
Client terminal is applied to, the client terminal is connected with service terminal, the method for holding length connection is used to keep client whole
End and the connection of service terminal.The method of holding length connection includes receiving what the service terminal sent the client terminal
Heartbeat packet carries out the response bag of response, and the response bag includes the performance parameter and client terminal hair of the service terminal
Send the time of heartbeat packet, according to current time, send heartbeat packet time and the service terminal performance parameter calculate away from
The time interval of next heartbeat packet is sent, and then next heartbeat is sent according to the time interval and is wrapped in service terminal, with
Set up and be connected with service terminal.Because the time interval is calculated in real time according to the performance parameter of the service terminal, therefore, subtract
Lacked the pressure of service terminal, while avoiding client terminal constantly sends heartbeat packet, save the electricity of client terminal with
And flow, improve Consumer's Experience sense.
To enable the above objects, features and advantages of the present invention to become apparent, preferred embodiment cited below particularly, and coordinate
Appended accompanying drawing, is described in detail below.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be attached to what is used required in embodiment
Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore is not construed as pair
The restriction of scope, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to this
A little accompanying drawings obtain other related accompanying drawings.
Fig. 1 shows a kind of schematic diagram of the application environment of method for keeping length to connect provided in an embodiment of the present invention.
Fig. 2 shows a kind of schematic flow sheet of method for keeping length to connect provided in an embodiment of the present invention.
Fig. 3 shows a kind of schematic flow sheet of the sub-step of method for keeping length to connect provided in an embodiment of the present invention.
Fig. 4 shows a kind of high-level schematic functional block diagram of device for keeping length to connect provided in an embodiment of the present invention.
Diagram:100- client terminals;200- networks;300- service terminals;110- keeps the device of long connection;111- is received
Module;112- computing modules;113- sending modules.
Embodiment
Below in conjunction with accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Ground is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.Generally exist
The component of the embodiment of the present invention described and illustrated in accompanying drawing can be arranged and designed with a variety of configurations herein.Cause
This, the detailed description of the embodiments of the invention to providing in the accompanying drawings is not intended to limit claimed invention below
Scope, but it is merely representative of the selected embodiment of the present invention.Based on embodiments of the invention, those skilled in the art are not doing
The every other embodiment obtained on the premise of going out creative work, belongs to the scope of protection of the invention.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi
It is defined in individual accompanying drawing, then it further need not be defined and explained in subsequent accompanying drawing.Meanwhile, the present invention's
In description, term " first ", " second " etc. are only used for distinguishing description, and it is not intended that indicating or implying relative importance.
Fig. 1 is refer to, is a kind of schematic diagram of the application environment of method for keeping length to connect provided in an embodiment of the present invention,
The method of holding length connection is applied to client terminal 100, and the client terminal 100 may be, but not limited to, mobile phone or flat board electricity
The mobile electronic devices such as brain.The client terminal 100 is communicated to connect by network 200 with service terminal 300, the service terminal 300
Can be, other electronic equipments such as desktop computer.The method of holding length connection is used to keep the client terminal 100 whole with service
The connection at end 300, in other words, the method for holding length connection are used to keep between client terminal 100 and service terminal 300
Communication.
Fig. 2 is refer to, is a kind of schematic flow sheet of method for keeping length to connect provided in an embodiment of the present invention, the holding
The method of long connection includes:
Step S110, receives the response bag for the heartbeat packet progress response that the service terminal is sent to the client terminal,
The response bag includes the performance parameter of the service terminal and the time of client terminal transmission heartbeat packet.
When client terminal 100 is communicated with service terminal 300, client terminal 100 is needed in real time to service terminal 300
Heartbeat packet is sent, service terminal 300 to know to remain with client terminal 100 be connected, in order to which client terminal 100 is with taking
Data transfer is carried out between business terminal 300.The client terminal 100 sends heartbeat packet to service terminal 300, and the heartbeat packet can be wrapped
Include, but be not limited to, current network type, the time for sending heartbeat packet and current network signal intensity, the current network type
It is 2G, 3G, 4G or Wi-Fi to show current network;The time of the transmission heartbeat packet is existing customer terminal 100 to service terminal
300 send the time of heartbeat packet, because client terminal 100 is continuously to send heartbeat packet to service terminal 300, therefore,
The time of the transmission heartbeat packet can efficiently differentiate different heartbeat packets.Such as heartbeat packet can be { NetType;
startTime;SignalIntensity }, wherein, NetType is current network type, and startTime is transmission heartbeat packet
Time, signalIntensity is current network signal intensity.
The service terminal 300 is received after the heartbeat packet of the transmission of client terminal 100, it will carry out response to the heartbeat packet,
Therefore, the service terminal 300 sends response bag after receiving heartbeat packet to client terminal 100, and the response bag includes the service terminal
300 performance parameter and client terminal 100 sends the time of heartbeat packet.In embodiments of the present invention, the service terminal 300
Performance parameter is the CPU usage of service terminal 300 and the memory usage of service terminal 300, it is readily appreciated that, the service
The performance parameter of terminal 300 can also be configured according to actual needs.The form of such as response bag can be { startTime;
cpu;Mem }, wherein, startTime is the time that client terminal 100 sends heartbeat packet, and cpu makes for the CPU of service terminal 300
With rate, mem is the memory usage of service terminal 300.
Step S120, according to current time, sends the time of heartbeat packet and the performance parameter calculating of the service terminal
Away from the time interval for sending next heartbeat packet.
The calculation is:
Dt=currentTime-startTime
T=(Dt*1.2) * (cpu*mem)
Wherein, currentTime is current time, and startTime is sends the time of heartbeat packet, and cpu is the service
The CPU usage of terminal 300, mem is the memory usage of the service terminal 300, and t is time interval.The time interval refers to
On the basis of current time, the time that next heartbeat packet is sent after the time interval is spaced.
It should be noted that Dt is the difference of the time of current time and the transmission heartbeat packet of last time client terminal 100, by Dt
It is multiplied by 1.2 and is to reserve 20% overdose space so that this heartbeat packet transmission frequency and last time heartbeat packet transmission frequency
Difference, if this heartbeat packet transmission frequency is identical with last time heartbeat packet transmission frequency, it is likely that cause not receive also
The response bag of the heartbeat packet sent to the last time, this will just send heartbeat packet again.
It is readily appreciated that, when the CPU usage of service terminal 300 or the memory usage of service terminal 300 are uprised, then
Time interval t becomes big, and client terminal 100 will send heartbeat packet with longer time interval to service terminal 300, to reduce clothes
The response pressure for terminal 300 of being engaged in, while avoiding client terminal 100 continually sends heartbeat packet, saves client terminal 100
Electricity and flow consumption, improve Consumer's Experience sense.
Step S130, next heartbeat packet is sent to the service terminal according to the time interval.
The client terminal 100 will send next heartbeat packet to service terminal 300 according to the time interval calculated, with
It is easy to inform that service terminal 300 continues to set up connection therewith.Specially:
Fig. 3 is refer to, is a kind of sub-step S130 of method for keeping length to connect provided in an embodiment of the present invention flow
Schematic diagram.Step S130 includes:
Step S131, if the time interval is less than pre-stored very first time interval, the very first time interval is arrived
Next heartbeat packet is sent to the service terminal when coming.
When the service terminal 300 without using or utilization rate it is too low when the value of time interval that calculates according to above-mentioned formula will
Very little, if the direct basis of client terminal 100 time interval sends next heartbeat packet to service terminal 300, client terminal
100 frequencies for sending heartbeat packet will be very high, consume idle work.
To avoid such a situation, client terminal 100 will set very first time interval, very first time interval be more than in service
The time interval calculated in the case that the utilization rate of terminal 300 is too low, more preferably, in embodiments of the present invention, this first when
Between be set to 1 second.I.e. when the time interval calculated is less than very first time interval, show making for service terminal 300
Too low with rate, to avoid client terminal 100 from excessively continually sending heartbeat packet to service terminal 300, client terminal 100 will be the
Heartbeat packet is sent when one time interval arrives to service terminal 300.
Step S132, if the time interval is more than the second pre-stored time interval, second time interval is arrived
Next heartbeat packet is sent to the service terminal when coming.
When the utilization rate of network delay or service terminal 300 is too high, the time interval calculated can be long, when between the time
The connection of client terminal 100 and service terminal 300 may be caused to disconnect when long.
In order to avoid above-mentioned situation occurs, the client terminal 100 is provided with the second time interval, and second time interval is small
In the time interval calculated when the utilization rate of network delay or service terminal 300 is too high, more preferably, in the embodiment of the present invention
In, second time interval is set to 3 seconds to 5 seconds.I.e. when the time interval calculated is more than the second time interval, show this
The utilization rate of service terminal 300 is too high, then client terminal 100 will send next heartbeat packet extremely when the second time interval arrives
Service terminal 300.
Step S133, if the time interval is more than pre-stored very first time interval and less than the second pre-stored time
Interval, then send next heartbeat packet to the service terminal when time interval arrives.
When the time interval even calculated is placed between very first time interval and the second time interval, then client terminal
100 send next heartbeat packet when the time interval arrives to service terminal 300.
Fig. 4 is refer to, is that a kind of functional module for keeping the long device 110 connected provided in an embodiment of the present invention is illustrated
Figure.The device 110 of holding length connection is applied to client terminal 100, and the device 110 of holding length connection includes receiving module
111st, computing module 112 and sending module 113, wherein,
Receiving module 111, response is carried out for receiving the heartbeat packet that the service terminal is sent to the client terminal
Response bag, the heartbeat packet that the performance parameter and the client terminal of the response bag including the service terminal are sent when
Between.
In embodiments of the present invention, step S110 can be performed by receiving module 111.
Computing module 112, for being joined according to the performance of current time, the time of transmission heartbeat packet and the service terminal
Number is calculated away from the time interval for sending next heartbeat packet.
In embodiments of the present invention, step S120 can be performed by computing module 112.
Sending module 113, for sending next heartbeat packet to the service terminal according to the time interval.
In embodiments of the present invention, step S130~S133 can be performed by sending module 113.
Due to keeping the method part of long connection to have been described in, it will not be repeated here.
In summary, a kind of method and device for keeping length to connect provided in an embodiment of the present invention, holding length connection
Method and device is applied to client terminal, and the client terminal is connected with service terminal, and the method for holding length connection is used for
Keep the connection of client terminal and service terminal.The method of holding length connection includes receiving the service terminal to the client
The heartbeat packet that terminal is sent carries out the response bag of response, the performance parameter of the response bag including the service terminal and described
Client terminal sends the time of heartbeat packet, according to current time, sends the time of heartbeat packet and the performance of the service terminal
Parameter is calculated away from the time interval for sending next heartbeat packet, and then is wrapped in clothes according to the next heartbeat of time interval transmission
Business terminal, is connected with being set up with service terminal.Because the time interval is counted in real time according to the performance parameter of the service terminal
Calculate, therefore, reduce the pressure of service terminal, while avoiding client terminal constantly sends heartbeat packet, save client whole
The electricity and flow at end, improve Consumer's Experience sense.
In several embodiments provided herein, it should be understood that disclosed apparatus and method, it can also pass through
Other modes are realized.Device embodiment described above is only schematical, for example, flow chart and block diagram in accompanying drawing
Show according to the device of multiple embodiments of the present invention, the architectural framework in the cards of method and computer program product,
Function and operation.At this point, each square frame in flow chart or block diagram can represent the one of a module, program segment or code
Part a, part for the module, program segment or code is used to realize holding for defined logic function comprising one or more
Row instruction.It should also be noted that in some implementations as replacement, the function of being marked in square frame can also with different from
The order marked in accompanying drawing occurs.For example, two continuous square frames can essentially be performed substantially in parallel, they are sometimes
It can perform in the opposite order, this is depending on involved function.It is also noted that every in block diagram and/or flow chart
The combination of individual square frame and block diagram and/or the square frame in flow chart, can use the special base for performing defined function or action
Realize, or can be realized with the combination of specialized hardware and computer instruction in the system of hardware.In addition, of the invention each
Each functional module in individual embodiment, which can be integrated, to form an independent part or modules are individually deposited
, can also two or more modules be integrated to form an independent part.
If the function is realized using in the form of software function module and is used as independent production marketing or in use, can be with
It is stored in a computer read/write memory medium.Understood based on such, technical scheme is substantially in other words
The part contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter
Calculation machine software product is stored in a storage medium, including some instructions are to cause a computer equipment (can be individual
People's computer, server, or network equipment etc.) perform all or part of step of each of the invention embodiment methods described.
It should be noted that herein, such as first and second or the like relational terms are used merely to an entity or behaviour
Make with another entity or operation make a distinction, and not necessarily require or imply these entities or operate between exist it is any this
Plant actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Include so that process, method, article or equipment including a series of key elements not only include those key elements, but also
Including other key elements being not expressly set out, or also include for this process, method, article or equipment intrinsic want
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Also there is other identical element in process, method, article or the equipment of element.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.It should be noted that:Similar label and letter exists
Similar terms is represented in following accompanying drawing, therefore, once being defined in a certain Xiang Yi accompanying drawing, is then not required in subsequent accompanying drawing
It is further defined and explained.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.
Claims (10)
1. a kind of method for keeping long connection, it is characterised in that applied to client terminal, the client terminal leads to service terminal
Letter connection, methods described is used to keep the client terminal to be connected with the length of the service terminal, and methods described includes:
The response bag for the heartbeat packet progress response that the service terminal is sent to the client terminal is received, the response bag includes
The performance parameter of the service terminal and the client terminal send the time of heartbeat packet;
According to current time, the time of heartbeat packet and the performance parameter calculating of the service terminal are sent away from the next heart of transmission
Jump the time interval of bag;
Next heartbeat packet is sent to the service terminal according to the time interval.
2. the method as claimed in claim 1 for keeping long connection, it is characterised in that the performance parameter of the service terminal includes
The memory usage of the CPU usage of the service terminal and the service terminal.
3. the method as claimed in claim 2 for keeping long connection, it is characterised in that described according to current time, transmission heartbeat
The performance parameter of the time of bag and the service terminal is calculated to be passed through with lower section away from the time interval for sending next heartbeat packet
Formula is realized:
Dt=currentTime-startTime
T=(Dt*1.2) * (cpu*mem)
Wherein, currentTime is current time, and startTime is sends the time of heartbeat packet, and cpu is the service terminal
CPU usage, mem be the service terminal memory usage, t is time interval.
4. the method as claimed in claim 1 for keeping long connection, it is characterised in that under the transmission according to the time interval
The step of one heartbeat packet to service terminal, includes:
If the time interval is less than pre-stored very first time interval, the very first time interval sends next when arriving
Heartbeat packet is to the service terminal;
If the time interval is more than the second pre-stored time interval, second time interval sends next when arriving
Heartbeat packet is to the service terminal;
If the time interval is more than pre-stored very first time interval and less than the second pre-stored time interval, when described
Between be spaced arrive when send next heartbeat packet to the service terminal.
5. the method as claimed in claim 1 for keeping long connection, it is characterised in that the heartbeat packet bag that the client terminal is sent
Include current network type, the time for sending heartbeat packet and current network signal intensity.
6. a kind of keep the long device connected, it is characterised in that applied to client terminal, the client communicates with service terminal
Connection, described device is used to keep the client terminal to be connected with the length of the service terminal, and described device includes:
Receiving module, the response bag of response is carried out for receiving the heartbeat packet that the service terminal is sent to the client terminal,
The time for the heartbeat packet that the performance parameter and the client terminal that the response bag includes the service terminal are sent;
Computing module, for being calculated according to the performance parameter of current time, the time of transmission heartbeat packet and the service terminal
Away from the time interval for sending next heartbeat packet;
Sending module, for sending next heartbeat packet to the service terminal according to the time interval.
7. as claimed in claim 6 keep the long device connected, it is characterised in that the performance parameter of the service terminal includes
The memory usage of the CPU usage of the service terminal and the service terminal.
8. as claimed in claim 7 keep the long device connected, it is characterised in that the computing module is real in the following manner
It is existing:
Dt=currentTime-startTime
T=(Dt*1.2) * (cpu*mem)
Wherein, currentTime is current time, and startTime is sends the time of heartbeat packet, and cpu is the service terminal
CPU usage, mem be the service terminal memory usage, t is time interval.
9. as claimed in claim 6 keep the long device connected, it is characterised in that the sending module is additionally operable to:
If the time interval is less than pre-stored very first time interval, the very first time interval sends next when arriving
Heartbeat packet is to the service terminal;
If the time interval is more than the second pre-stored time interval, second time interval sends next when arriving
Heartbeat packet is to the service terminal;
If the time interval is more than pre-stored very first time interval and less than the second pre-stored time interval, when described
Between be spaced arrive when send next heartbeat packet to the service terminal.
10. as claimed in claim 6 keep the long device connected, it is characterised in that the heartbeat packet that the client terminal is sent
Including current network type, the time of transmission heartbeat packet and current network signal intensity.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710720362.1A CN107276859B (en) | 2017-08-21 | 2017-08-21 | Keep the method and device of long connection |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710720362.1A CN107276859B (en) | 2017-08-21 | 2017-08-21 | Keep the method and device of long connection |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107276859A true CN107276859A (en) | 2017-10-20 |
CN107276859B CN107276859B (en) | 2019-10-25 |
Family
ID=60076387
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710720362.1A Active CN107276859B (en) | 2017-08-21 | 2017-08-21 | Keep the method and device of long connection |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107276859B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107612789A (en) * | 2017-11-09 | 2018-01-19 | 北京奇艺世纪科技有限公司 | The heartbeat interval adjusting method and device of a kind of client |
CN111314492A (en) * | 2020-03-31 | 2020-06-19 | 广东美的制冷设备有限公司 | Air conditioner, data transmission method thereof and computer readable storage medium |
CN111866431A (en) * | 2020-07-27 | 2020-10-30 | 广州通达汽车电气股份有限公司 | Wireless high-speed networking storage system and method for bus monitoring video |
CN114114993A (en) * | 2021-11-01 | 2022-03-01 | 集度科技有限公司 | Vehicle control method, server, vehicle and vehicle system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1972252A (en) * | 2006-10-13 | 2007-05-30 | 蒋晓海 | A method for maintaining communication connection in mobile instant communication |
US20100290335A1 (en) * | 2009-05-13 | 2010-11-18 | Avaya Inc. | Method and apparatus for locally implementing port selection via synchronized port state databases maintained by the forwarding plane of a network element |
CN103139303A (en) * | 2013-02-07 | 2013-06-05 | 网易(杭州)网络有限公司 | Method, device and system used for maintaining connected heartbeat |
CN103685241A (en) * | 2013-11-26 | 2014-03-26 | 中国科学院计算技术研究所 | Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol) |
CN103716323A (en) * | 2013-12-31 | 2014-04-09 | 厦门悦讯信息科技有限公司 | Method for maintaining long connection by sending heartbeat packet |
CN106535309A (en) * | 2016-10-28 | 2017-03-22 | 珠海市魅族科技有限公司 | Method and device for keeping network connection |
-
2017
- 2017-08-21 CN CN201710720362.1A patent/CN107276859B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1972252A (en) * | 2006-10-13 | 2007-05-30 | 蒋晓海 | A method for maintaining communication connection in mobile instant communication |
US20100290335A1 (en) * | 2009-05-13 | 2010-11-18 | Avaya Inc. | Method and apparatus for locally implementing port selection via synchronized port state databases maintained by the forwarding plane of a network element |
CN103139303A (en) * | 2013-02-07 | 2013-06-05 | 网易(杭州)网络有限公司 | Method, device and system used for maintaining connected heartbeat |
CN103685241A (en) * | 2013-11-26 | 2014-03-26 | 中国科学院计算技术研究所 | Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol) |
CN103716323A (en) * | 2013-12-31 | 2014-04-09 | 厦门悦讯信息科技有限公司 | Method for maintaining long connection by sending heartbeat packet |
CN106535309A (en) * | 2016-10-28 | 2017-03-22 | 珠海市魅族科技有限公司 | Method and device for keeping network connection |
Non-Patent Citations (1)
Title |
---|
沈晓: "《TCP异步长连接的选择及心跳处理机制的实现》", 《中国金融电脑》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107612789A (en) * | 2017-11-09 | 2018-01-19 | 北京奇艺世纪科技有限公司 | The heartbeat interval adjusting method and device of a kind of client |
CN107612789B (en) * | 2017-11-09 | 2020-08-28 | 北京奇艺世纪科技有限公司 | Heartbeat interval adjusting method and device for client |
CN111314492A (en) * | 2020-03-31 | 2020-06-19 | 广东美的制冷设备有限公司 | Air conditioner, data transmission method thereof and computer readable storage medium |
CN111866431A (en) * | 2020-07-27 | 2020-10-30 | 广州通达汽车电气股份有限公司 | Wireless high-speed networking storage system and method for bus monitoring video |
CN114114993A (en) * | 2021-11-01 | 2022-03-01 | 集度科技有限公司 | Vehicle control method, server, vehicle and vehicle system |
Also Published As
Publication number | Publication date |
---|---|
CN107276859B (en) | 2019-10-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107276859A (en) | Keep the method and device of long connection | |
CN104601203B (en) | A kind of low-power consumption bluetooth equipment dynamically adjusts the method and device of Connecting quantity | |
CN110417650A (en) | Multilink data distribution method, device and electronic equipment | |
CN103634149B (en) | A kind of monitoring method for distributed system | |
CN108712485A (en) | A kind of resource subscription method and apparatus of internet of things equipment | |
CN110381130A (en) | The long connection method of keep-alive, device, communication terminal and storage medium | |
CN105208125A (en) | Message transmission method, device and system | |
CN102298542A (en) | Application program quality determination method and system | |
CN107333287B (en) | Network detecting method, network detection device and intelligent terminal | |
CN107992394A (en) | Monitoring method, device, system, equipment and the storage medium of real time data processing | |
CN109783151A (en) | The method and apparatus of rule change | |
CN106550438A (en) | Limit method and system, the mobile device of periodic wakeup | |
CN102802214A (en) | System and method for rate self-adaptation based on WLAN (Wireless Local Area Network) | |
CN110445932A (en) | Exception falls card processing method, device, storage medium and terminal | |
CN103885871A (en) | Power consumption display method and device, and mobile terminal | |
CN105357387B (en) | A kind of method, apparatus and system for waking up terminal | |
CN105430721A (en) | Data interaction control method, data interaction control device and wearable equipment | |
CN103347071B (en) | MIPI data transmission control method and electronic device | |
CN110519781A (en) | RRC time limit method of adjustment and device, mobile terminal and readable storage medium storing program for executing | |
CN201781505U (en) | Customized application platform system | |
CN108601098A (en) | The recognition methods of the network formats of double-terminal and device | |
CN105992280A (en) | Method and device for data processing | |
CN108345650A (en) | Electronic invoice business monitors method for early warning and system in real time | |
CN107181625A (en) | Data, services provide method and device | |
CN104268222B (en) | The monitoring method and device of promoted account Action Events |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |