CN107995235A - The method and terminal that a kind of keep-alive time determines - Google Patents

The method and terminal that a kind of keep-alive time determines Download PDF

Info

Publication number
CN107995235A
CN107995235A CN201610951091.6A CN201610951091A CN107995235A CN 107995235 A CN107995235 A CN 107995235A CN 201610951091 A CN201610951091 A CN 201610951091A CN 107995235 A CN107995235 A CN 107995235A
Authority
CN
China
Prior art keywords
keep
alive
duration
channel
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.)
Pending
Application number
CN201610951091.6A
Other languages
Chinese (zh)
Inventor
吴亦川
郑健平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Communications Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Communications Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Communications Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201610951091.6A priority Critical patent/CN107995235A/en
Publication of CN107995235A publication Critical patent/CN107995235A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses the method and terminal that a kind of keep-alive duration determines, is fixed to solve to exist in the prior art keep-alive duration in the keepalive mechanism of wireless MQTT message systems so that there are more problem of resource waste for server and terminal.In the embodiment of the present invention, terminal determines that keep-alive adjusts duration according to the channel status of channel;Definite keep-alive adjustment duration notice server, server are received the keep-alive adjustment duration of terminal notification by terminal;Server adjusts keep-alive duration of the duration to channel according to the keep-alive and is adjusted; the keep-alive duration of channel can flexibly be changed according to the channel status of channel using the method for the embodiment of the present invention; the utilization rate of signal resource between server and terminal is improved, reduces the waste of resource.

Description

The method and terminal that a kind of keep-alive time determines
Technical field
The present invention relates to field of communication technology, method and terminal that more particularly to a kind of keep-alive time determines.
Background technology
Wireless MQTT(Message Queuing Telemetry Transport, message queue remote measurement transmission)Message system System is based on MQTT protocol realizations and applied to the immediate news systems of wireless network.Terminal such as mobile phone, PAD(Tablet)Etc. can To realize the functions such as one-to-one chat, group chat, mass-sending by wireless MQTT message systems.In wireless MQTT message systems, terminal Mainly maintain to communicate by establishing long connection with server.When terminal is sent without message, in order to maintain long connection status, need Carry out keepalive mechanism.Using keepalive mechanism, terminal and server determines whether other side is in running order, and then is handed over Mutually.
As shown in Figure 1, keepalive mechanism is carried out between existing terminal and server interacts schematic diagram, terminal sends out first Go out CONNECT(Connection)Demand signalling, Keep Alive are carried in signaling(Keep-alive)Field and server end are held consultation, service Device allows terminal to send CONNACK after connecting(Confirm)Response.Keep-alive duration is included in Keep Alive fields, refers to server The maximum time interval of message is received from terminal.When being sent without other message, terminal must be sent in this duration PINGREQ(Heartbeat)Signaling carrys out keep-alive, the connection between maintenance and server.After server receives PINGREQ requests, feedback PINGRESP(Heartbeat responds)Message is responded.
The signaling sent between terminal and server in keep-alive duration(Including PINGREQ and PINGRESP signalings)Belong to Overhead.Extra flow and expense, and power consumption are generated for terminal.For server, it is wireless to occupy part Access bandwidth.
To sum up, keep-alive duration is fixed in the keepalive mechanism of existing wireless MQTT message systems so that server and There are the more wasting of resources for terminal.
The content of the invention
The present invention provides the method and terminal that a kind of keep-alive duration determines, to solve to exist in the prior art wireless MQTT Keep-alive duration is fixed in the keepalive mechanism of message system so that there are more problem of resource waste for server and terminal.
The embodiment of the present invention provides a kind of method that keep-alive duration determines, including:
Terminal determines that keep-alive adjusts duration according to the channel status of channel;
Definite keep-alive adjustment duration is notified server by the terminal, so that the server is adjusted according to the keep-alive Keep-alive duration of the duration to channel is adjusted.
The embodiment of the present invention provides a kind of method that keep-alive duration determines, including:
Server receives the keep-alive adjustment duration of terminal notification;
The server adjusts keep-alive duration of the duration to channel according to the keep-alive and is adjusted.
The embodiment of the present invention provides the terminal that a kind of keep-alive duration determines, which includes:
First processing module, for determining that keep-alive adjusts duration according to the channel status of channel;
First transport module, for definite keep-alive adjustment duration to be notified server, so that the server is according to institute Keep-alive duration of the keep-alive adjustment duration to channel is stated to be adjusted.
The embodiment of the present invention provides the server that a kind of keep-alive duration determines, which includes:
Second transport module, the keep-alive for receiving terminal notification adjust duration;
Second processing module, is adjusted for adjusting keep-alive duration of the duration to channel according to the keep-alive.
In the embodiment of the present invention, terminal determines that keep-alive adjusts duration according to the channel status of channel;The guarantor that terminal will determine Adjustment duration notice server living, server receive the keep-alive adjustment duration of terminal notification;Server is according to the keep-alive tune Keep-alive duration of the whole duration to channel is adjusted, can be according to the channel status spirit of channel using the method for the embodiment of the present invention The keep-alive duration of change channel living, improves the utilization rate of signal resource between server and terminal, reduces the waste of resource.
Brief description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for this For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these attached drawings His attached drawing.
What Fig. 1 carried out keepalive mechanism between existing terminal and server interacts schematic diagram;
Fig. 2 is the structure diagram for the system that keep-alive duration of the embodiment of the present invention determines;
Fig. 3 is the first PINGREQ message format structure diagram that the embodiment of the present invention newly defines;
Fig. 4 is existing PINGREQ message formats structure diagram;
Fig. 5 is second of PINGREQ message format structure diagram that the embodiment of the present invention newly defines;
Fig. 6 is the PINGRESP message format structure diagrams that the embodiment of the present invention newly defines;
Fig. 7 is existing PINGRESP message formats structure diagram;
Fig. 8 is the structure diagram of terminal in the system that keep-alive duration of the embodiment of the present invention determines;
Fig. 9 is the structure diagram of server in the system that keep-alive duration of the embodiment of the present invention determines;
Figure 10 is the schematic diagram that keep-alive duration in end side of the embodiment of the present invention determines method;
Figure 11 is the schematic diagram that server side keep-alive duration of the embodiment of the present invention determines method;
Figure 12 is the flow chart that the embodiment of the present invention determines keep-alive duration deviation value;
Figure 13 is the process flow diagram flow chart that keep-alive duration of the embodiment of the present invention determines.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearer, the present invention is made below in conjunction with attached drawing into One step it is described in detail, it is clear that described embodiment only part of the embodiment of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, those of ordinary skill in the art are obtained without making creative work All other embodiment, belongs to the scope of protection of the invention.
The embodiment of the present invention is described in further detail with reference to Figure of description.
In following declarative procedure, first implement to illustrate from the cooperation of end side and server side, finally respectively from The implementation of end side and server side illustrates, but this does not imply that the two must coordinate implementation, in fact, working as end side When being performed separately with server side, also solve respectively in the problems of end side and server side.Only both combine In use, superior technique effect can be obtained.
As shown in Fig. 2, the system that keep-alive duration of the embodiment of the present invention determines:Including terminal 20 and server 21;
Terminal 20, for determining that keep-alive adjusts duration according to the channel status of channel;Definite keep-alive adjustment duration is led to Know server 21, be adjusted so that the server 21 adjusts keep-alive duration of the duration to channel according to the keep-alive;
Server 21, the keep-alive for receiving the notice of terminal 20 adjust duration;Duration is adjusted to letter according to the keep-alive The keep-alive duration in road is adjusted.
It should be noted that can determine whether a keep-alive duration base value when terminal 20 and server 21 connect first, and with Keep-alive duration of the base value as channel, when being adjusted the setting new keep-alive of channel to the base value further according to channel status afterwards It is long.
Wherein, keep-alive duration base value is one according to emulation, the empirical value of simulation gained.
Before the terminal 20 determines keep-alive adjustment duration according to the channel status of channel, terminal 20 is it needs to be determined that channel Channel status, determine that the process of channel status is as follows:
The terminal 20 determines the average packet loss ratio of channel and temporary transient packet loss;
The terminal 20 is true according to average packet loss ratio, temporary transient packet loss and average packet loss ratio and the difference of temporary transient packet loss Determine channel status;
If the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, and the terminal 20 determines Channel status is error-free state;
If the average packet loss ratio is less than the temporary transient packet loss, and difference is more than second threshold, and the terminal 20 determines Channel status is error status.
Need what is illustrated, average packet loss ratio, temporary transient packet loss can be obtained by power rolling average filter algorithm, average packet loss Rate refers to the long-term transmission status that in a packet loss for setting channel in the period, can reflect channel, sets the period It can be manually set, can also be by system sets itself, temporary transient packet loss refers to the packet loss of channel at that time, can reflect channel Transmission status at that time.In certain embodiments, when calculating the period set by average packet loss ratio very in short-term, averagely lose Bag rate can become into or equivalent to or being defined as packet loss sometime.
Wherein, the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, illustrates channel at that time Packet loss it is smaller, transmission status is preferable, thus can be assumed that channel status be error-free state;The average packet loss ratio is less than The temporary transient packet loss, and difference is more than second threshold, illustrates that the packet drop of channel at that time is serious, transmission status compared with Difference, therefore can be assumed that channel status is error status;Wherein first threshold and second threshold be according to system status by emulation, Simulate the empirical value obtained.
In fact, determine that channel status is not limited to according to average packet loss ratio, temporary transient packet loss and average packet loss ratio Determined with the difference of temporary transient packet loss, the channel status of channel can also be determined according to the length of channel response time, such as The channel status that channel is determined when the channel response time being more than given threshold is error status, is not more than when the channel response time Given threshold is to determine that the channel status of channel is error-free state;
The channel status of channel only can also be determined by average packet loss ratio, the magnitude relationship of temporary transient packet loss, such as When the average packet loss ratio is more than the temporary transient packet loss, it is error-free state to determine channel status, when average packet loss ratio is less than temporarily When packet loss, it is error status to determine channel status;Determine channel status mode have it is many in, it is every to determine channel shape The mode of state is suitable for the embodiment of the present invention.
It should be noted that if average packet loss ratio is more than temporary transient packet loss and difference is not more than first threshold, or averagely lose Bag rate is less than temporary transient packet loss and difference is not more than second threshold, thinks that channel status is unchanged at this time, to terminal 20 and service The keep-alive duration of channel is without adjustment between device 21.
When channel status is error-free state, the keep-alive duration between terminal 20 and server 21 can be set as one compared with Long duration value, to reduce between terminal 20 and server 21 to maintain the signal resource of long linkup transmit, saves signaling money Source;When channel status is error status, the keep-alive duration between terminal 20 and server 21 can be set as one it is less Duration value, to ensure comparatively fast determine whether the working status of both sides is normal between terminal 20 and server 21, ensures terminal Normal communication between 20 and server 21.
Wherein, a length of keep-alive duration deviation value or keep-alive duration setting value during the keep-alive adjustment.
When the keep-alive adjusts during a length of keep-alive duration deviation value, the terminal 20 needs definite keep-alive duration is inclined From value and channel status notice server 21, so that the server 21 deviates according to the channel status and keep-alive duration Keep-alive duration of the value to the channel is adjusted, this is because keep-alive duration deviation value is a less duration value, is issued Server 21 sends keep-alive duration deviation value, and server 21 only can not determine how adjustment channel according to keep-alive duration deviation value Keep-alive duration, so needing also to notify channel status to server 21, can determine to reduce according to channel status server 21 Keep-alive duration still increases keep-alive duration.
Terminal 20 determines that the mode of keep-alive adjustment duration is as follows:
Mode one:The terminal 20 determines channel status according to channel status and the correspondence of keep-alive duration deviation value Corresponding keep-alive duration deviation value;
The correspondence of channel status and keep-alive duration deviation value, can be the channel status and keep-alive duration being manually set Between the channel status and keep-alive duration deviation value of one-to-one relationship or default between deviation value one by one Correspondence, wherein keep-alive duration deviation value can be the empirical values by emulating or simulating acquisition;
For example, the corresponding keep-alive duration deviation value of error-free state is 3 minutes, the corresponding keep-alive duration deviation value of error status For 2 minutes, if channel status is error-free state, terminal 20 determined that keep-alive duration deviation value is 3 minutes;If channel status is Wrong state, then terminal 20 determine keep-alive duration deviation value be 2 minutes.
Mode two:The terminal 20 determines the channel status of channel according to channel status and the correspondence of keep-alive duration Corresponding keep-alive duration setting value;
The correspondence of channel status and keep-alive duration, can be the channel status and keep-alive duration setting value being manually set Between one-to-one relationship or one-to-one corresponding between the channel status and keep-alive duration setting value of default close System, wherein keep-alive duration setting value can be the empirical value by emulating or simulating acquisition;
For example, the corresponding keep-alive duration setting value of error-free state is 7 minutes, the corresponding keep-alive duration setting value of error status Deviation value is 7 minutes, if channel status is error-free state, terminal 20 determines that keep-alive duration setting value is 4 minutes;If channel shape State is error status, then terminal 20 determines that keep-alive duration setting value is 3 minutes.
It should be noted that if channel status is unchanged, between terminal 20 and server 21 the keep-alive duration of channel not into Row adjustment, then its corresponding keep-alive duration deviation value is zero, and keep-alive duration setting value is the keep-alive duration base value of channel.
After terminal 20 determines keep-alive adjustment duration, keep-alive adjustment duration is notified that advice method has to server 21 The following two kinds mode:
Definite keep-alive duration deviation value and the channel status are notified server 21 by mode one, terminal 20;
Terminal 20 can use PINGREQ as shown in Figure 3(Keep-alive is asked)Message format by keep-alive duration deviation value and The channel status notifies server 21;
It is existing PINGREQ message formats in Fig. 4, PINGREQ messages are 2 bits, wherein containing MQTT control reports Literary type, reserved bit and residue length position, residue length position do not have practical significance, the main function of existing PINGREQ messages It is the long connection maintained at the end of keep-alive duration with server 21;
It is the PINGREQ message formats newly defined in Fig. 3, PINGREQ messages are 1 bit, wherein containing MQTT controls The binary numeral of type of message, channel status bit and keep-alive duration deviation value, wherein the numerical value of the 4th~7 represents MQTT controls Type of message processed, is 12 for the corresponding numerical value of keep-alive request message, and binary numeral 1100, the 3rd is channel status bit, Corresponding numerical value represents channel status, is error-free state when can set channel status bit as 0, is when channel status bit is 1 Wrong state, the numerical value of the 0th~2 represent keep-alive duration deviation value, and the unit of keep-alive duration deviation value can be set as minute;
For example, if channel status is error-free state, keep-alive duration deviation value is 3 minutes, then the content of PINGREQ messages is For 11000011;If channel status is error status, keep-alive duration deviation value is 2 minutes, then the content of PINGREQ messages is 11001010;
It should be noted that if channel status is unchanged, corresponding keep-alive duration deviation value is zero, then PINGREQ messages Middle channel status bit can be that 0 content for being alternatively 1, PINGREQ messages is 11000000 or 11001000.
Definite keep-alive duration setting value and the channel status are notified server 21 by mode two, terminal 20;
Terminal 20 can use PINGREQ message formats as shown in Figure 5 that keep-alive duration setting value is notified server 21, It is the PINGREQ message formats newly defined in Fig. 5, PINGREQ messages are 1 bit, wherein MQTT control type of messages are contained, The binary numeral of keep-alive duration setting value, wherein the numerical value of the 4th~7 represents MQTT control type of messages, please for keep-alive It is 12 to seek the corresponding numerical value of message, and the numerical value that binary numeral is the 1100, the 0th~3 represents the setting of keep-alive duration, keep-alive duration The unit of setting value can be set as minute;
For example, if keep-alive duration setting value is 7 minutes, the content of PINGREQ messages is 11000111.
Need what is illustrated, in the definite letter of terminal 20 when terminal 20 determines that channel keep-alive residual time length is not more than given threshold The keepalive state in road, and then determine that keep-alive adjusts duration according to the channel status of channel;Wherein, given threshold can be taking human as setting Put, can also system set, such as given threshold can be zero, determine channel keep-alive residual time length no more than setting when terminal 20 When determining threshold value, namely, it is necessary to when maintaining long connection with server 21 at the end of channel keep-alive duration, terminal 20 determines the letter of channel Road state, and then determine that keep-alive adjusts duration according to the channel status of channel, and definite keep-alive adjustment duration is notified to clothes Business device 21.
Server 21 can be received the keep-alive adjustment duration that terminal 20 notifies by following two modes:
Mode one, server 21 receive the channel status and keep-alive duration deviation value of the channel of the notice of terminal 20;
Server 21 receives PINGREQ messages as shown in Figure 3, and the channel status and keep-alive duration for determining channel deviate Value.For example, the content that server 21 receives PINGREQ messages is 11000011, the numerical value that server 21 obtains the 3rd is 0, really The channel status for determining channel is error-free state, and the numerical value that server 21 obtains the 0th~2 is 011, determines keep-alive duration deviation value For 3 minutes;The content that server 21 receives PINGREQ messages is 11001010, and the numerical value that server 21 obtains the 3rd is 1, really The channel status for determining channel is error status, and the numerical value that server 21 obtains the 0th~2 is 010, determines keep-alive duration deviation value For 2 minutes.
Mode two, server 21 receive the keep-alive duration setting value of the notice of terminal 20;
Server 21 receives PINGREQ messages as shown in Figure 5, determines to work as keep-alive duration setting value.For example, server 21 The content for receiving PINGREQ messages is 11000111, and the numerical value that server 21 obtains the 0th~3 is 0111, determines keep-alive duration Setting value is 7 minutes.
Server 21, can be according to the following two kinds mode to channel after the keep-alive adjustment duration of the notice of terminal 20 is received Keep-alive duration is adjusted:
Mode one, server 21 adjust the keep-alive duration of channel according to the channel status and keep-alive duration deviation value of channel;
If channel status is error-free state, the server 21 is by channel keep-alive duration base value and keep-alive duration deviation value Channel keep-alive duration is used as with value;
If channel status is error status, the server 21 is by channel keep-alive duration base value and keep-alive duration deviation value Difference is as channel keep-alive duration.
For example, channel keep-alive duration base value is 5 minutes, 21 channel status of server is error-free state, and keep-alive duration is inclined Be 3 minutes from value, then server 21 by channel keep-alive duration base value 5 minutes and keep-alive duration deviation value 3 minutes and be worth namely 8 Minute is used as channel keep-alive duration;Channel keep-alive duration base value is 5 minutes, and 21 channel status of server is error status, and is protected Duration deviation value living is 2 minutes, then server 21 was by channel keep-alive duration base value 5 minutes and keep-alive duration deviation value 2 minutes Difference namely 3 minutes conduct channel keep-alive durations.
Mode two, server 21 adjust the keep-alive duration of channel according to keep-alive duration setting value;
The server 21 is using the keep-alive duration setting value as channel keep-alive duration.
For example, server 21 determines that keep-alive duration setting value is 7 minutes, then server 21 is by the keep-alive duration setting value It is used as channel keep-alive duration within 7 minutes.
After server 21 adjusts channel keep-alive duration, server 21 can use as shown in Figure 6 PINGRESP(Keep-alive responds)Message format sends feedback information to terminal 20;
Fig. 7 is existing PINGRESP message formats, and PINGRESP messages are 2 bits, wherein containing MQTT control reports Literary type, reserved bit and residue length position, the effect of wherein reserved bit are if XXX, and residue length position does not have practical significance, The main function of existing PINGRESP messages is to send PINGREQ to terminal 20 to feed back, and maintains server 21 and terminal 20 Between connection.
The PINGRESP message formats newly defined for the embodiment of the present invention in Fig. 7, PINGRESP messages are 1 bit, wherein MQTT control type of messages, the binary numeral of reserved bit are contained, wherein the numerical value of the 4th~7 represents MQTT control messages Type, is 13 for the corresponding numerical value of keep-alive response message, the numerical value that binary numeral is the 1101, the 0th~3 is reserved bit.
As shown in figure 8, terminal includes in the system that present specification embodiment keep-alive duration determines:First processing module 800 With the first transport module 801;
First processing module 800, for determining that keep-alive adjusts duration according to the channel status of channel;
First transport module 801, for keep-alive adjustment duration notice server that will be definite so that the server according to Keep-alive duration of the keep-alive adjustment duration to channel is adjusted.
Before the first processing module 800 determines keep-alive adjustment duration according to the channel status of channel, the first processing Module 800 determines that the process of channel status is as follows it needs to be determined that the channel status of channel:
The first processing module 800 determines the average packet loss ratio of channel and temporary transient packet loss;
The first processing module 800 is according to average packet loss ratio, temporary transient packet loss and average packet loss ratio and temporary transient packet loss The difference of rate determines channel status;
If the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, the first processing mould Block 800 determines that channel status is error-free state;
If the average packet loss ratio is less than the temporary transient packet loss, and difference is more than second threshold, the first processing mould Block 800 determines that channel status is error status.
Wherein, the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, illustrates channel at that time Packet loss it is smaller, transmission status is preferable, thus can be assumed that channel status be error-free state;The average packet loss ratio is less than The temporary transient packet loss, and difference is more than second threshold, illustrates that the packet drop of channel at that time is serious, transmission status compared with Difference, therefore can be assumed that channel status is error status;Wherein first threshold and second threshold be according to system status by emulation, Simulate the empirical value obtained.
It should be noted that if average packet loss ratio is more than temporary transient packet loss and difference is not more than first threshold, or averagely lose Bag rate is less than temporary transient packet loss and difference is not more than second threshold, thinks that channel status is unchanged at this time, to terminal and server Between channel keep-alive duration without adjustment.
Wherein, a length of keep-alive duration deviation value or keep-alive duration setting value during the keep-alive adjustment.
When the keep-alive adjusts during a length of keep-alive duration deviation value, the first processing module 800 need by determine Keep-alive duration deviation value and channel status notice server, during so that the server is according to the channel status and keep-alive Keep-alive duration of the long deviation value to the channel is adjusted.
First processing module 800 determines that the mode of keep-alive adjustment duration is as follows:
Mode one:The first processing module 800 is determined according to channel status and the correspondence of keep-alive duration deviation value The corresponding keep-alive duration deviation value of channel status;
Mode two:The first processing module 800 determines channel according to channel status and the correspondence of keep-alive duration The corresponding keep-alive duration setting value of channel status;
After first processing module 800 determines keep-alive adjustment duration, the first transport module 801 leads to keep-alive adjustment duration Know that, to server, advice method has following two ways:
Definite keep-alive duration deviation value and the channel status are notified server by mode one, the first transport module 801;
Definite keep-alive duration setting value and the channel status are notified server by mode two, the first transport module 801;
Need what is illustrated, when first processing module 800 determines that channel keep-alive residual time length is not more than given threshold One processing module 800 determines the channel status of channel, and then determines that keep-alive adjusts duration according to the channel status of channel;Wherein, Given threshold can be taking human as setting, can also system setting.
As shown in figure 9, server includes in the system that present specification embodiment keep-alive duration determines:Second transport module 900 and Second processing module 901;
Second transport module 900, the keep-alive for receiving terminal notification adjust duration;
Second processing module 901, is adjusted for adjusting keep-alive duration of the duration to channel according to the keep-alive.
Second transport module 900 can be received the keep-alive adjustment duration of terminal notification by following two modes:
Mode one, the second transport module 900 receive the channel status and keep-alive duration deviation value of the channel of terminal notification;
Mode two, the second transport module 900 receive the keep-alive duration setting value of terminal notification;
For second transport module 900 after the keep-alive for receiving terminal notification adjusts duration, Second processing module 901 can basis Keep-alive duration of the following two kinds mode to channel is adjusted:
Mode one, Second processing module 901 adjust the guarantor of channel according to the channel status and keep-alive duration deviation value of channel Duration living;
If channel status is error-free state, the Second processing module 901 is by channel keep-alive duration base value and keep-alive duration Deviation value is used as channel keep-alive duration with value;
If channel status is error status, the Second processing module 901 is by channel keep-alive duration base value and keep-alive duration The difference of deviation value is as channel keep-alive duration.
Mode two, Second processing module 901 adjust the keep-alive duration of channel according to keep-alive duration setting value;
The Second processing module 901 is using the keep-alive duration setting value as channel keep-alive duration.
After Second processing module 901 adjusts channel keep-alive duration, the second transport module 900 can be used as schemed PINGRESP message formats shown in 6 send feedback information to terminal.
Based on same inventive concept, this discovery embodiment additionally provides a kind of method that keep-alive duration determines due to the terminal The principle solved the problems, such as is similar to the system that keep-alive duration of the embodiment of the present invention determines, thus the implementation of this method may refer to be The implementation of system, overlaps will not be repeated.
As shown in Figure 10, the method that present specification embodiment keep-alive duration determines, includes the following steps:
Step 1001:Terminal determines that keep-alive adjusts duration according to the channel status of channel;
Step 1002:Definite keep-alive adjustment duration is notified server by terminal, so that the server is according to the guarantor Keep-alive duration of the adjustment duration living to channel is adjusted.
Wherein, a length of keep-alive duration deviation value or keep-alive duration setting value during the keep-alive adjustment.
Before the terminal determines keep-alive adjustment duration according to the channel status of channel, terminal is it needs to be determined that the letter of channel Road state, determines that the process of channel status is as follows:
The terminal determines the average packet loss ratio of channel and temporary transient packet loss;
The terminal is determined according to average packet loss ratio, temporary transient packet loss and average packet loss ratio and the difference of temporary transient packet loss Channel status;
If the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, and the terminal determines to believe Road state is error-free state;
If the average packet loss ratio is less than the temporary transient packet loss, and difference is more than second threshold, and the terminal determines to believe Road state is error status.
When the keep-alive adjusts during a length of keep-alive duration deviation value, the terminal needs to deviate definite keep-alive duration Value and the channel status notice server so that the server according to the channel status and keep-alive duration deviation value to institute The keep-alive duration for stating channel is adjusted.
Terminal determines that the mode of keep-alive adjustment duration is as follows:
Mode one:The terminal determines channel status pair according to channel status and the correspondence of keep-alive duration deviation value The keep-alive duration deviation value answered;
Mode two:The terminal determines the channel status pair of channel according to channel status and the correspondence of keep-alive duration The keep-alive duration setting value answered;
After terminal determines keep-alive adjustment duration, keep-alive adjustment duration is notified have as follows to server, advice method Two ways:
Definite keep-alive duration deviation value and the channel status are notified server by mode one, terminal;
Definite keep-alive duration setting value and the channel status are notified server by mode two, terminal;
Need what is illustrated, when terminal determines that channel keep-alive residual time length is not more than given threshold terminal 20 determine channel Keepalive state, and then according to the channel status of channel determine keep-alive adjust duration;Wherein, given threshold can taking human as setting, Can also system setting.
Based on same inventive concept, this discovery embodiment additionally provides a kind of method that keep-alive duration determines due to the terminal The principle solved the problems, such as is similar to the system that keep-alive duration of the embodiment of the present invention determines, thus the implementation of this method may refer to be The implementation of system, overlaps will not be repeated.
As shown in figure 11, the method that present specification embodiment keep-alive duration determines, includes the following steps:
Step 1101:Server receives the keep-alive adjustment duration of terminal notification;
Step 1102:Server adjusts keep-alive duration of the duration to channel according to the keep-alive and is adjusted.
Server can be received the keep-alive adjustment duration of terminal notification by following two modes:
Mode one, server receive the channel status and keep-alive duration deviation value of the channel of terminal notification;
Mode two, server receive the keep-alive duration setting value of terminal notification;
Server, can be according to keep-alive of the following two kinds mode to channel after the keep-alive for receiving terminal notification adjusts duration Duration is adjusted:
Mode one, server adjust the keep-alive duration of channel according to the channel status and keep-alive duration deviation value of channel;
If channel status is error-free state, the server by channel keep-alive duration base value and keep-alive duration deviation value and Value is used as channel keep-alive duration;
If channel status is error status, the server is by the difference of channel keep-alive duration base value and keep-alive duration deviation value Value is used as channel keep-alive duration.
Mode two, server adjust the keep-alive duration of channel according to keep-alive duration setting value;
The server is using the keep-alive duration setting value as channel keep-alive duration.
After server adjusts channel keep-alive duration, server 21 can use PINGRESP as shown in Figure 6 Message format sends feedback information to terminal 20.
As shown in figure 12, the flow diagram of keep-alive duration deviation value is determined for the embodiment of the present invention, is comprised the following steps:
Step 1201:Terminal determines the average packet loss ratio of channel and temporary transient packet loss;
Step 1202:Terminal judges whether that average packet loss ratio is less than temporary transient packet loss and difference is more than second threshold, if It is then to perform step 1203, otherwise performs step 1204;
Step 1203:Terminal determines that channel status is error-free state;
Step 1204:Terminal judges whether that average packet loss ratio is more than temporary transient packet loss and difference is more than first threshold, if It is then to perform step 1205, otherwise performs step 1201;
Step 1205:Terminal determines that channel status is error status;
Step 1206:Terminal determines the channel shape of channel according to channel status and the correspondence of keep-alive duration deviation value The corresponding keep-alive duration deviation value of state;
Step 1207:Terminal builds PINGREQ messages according to channel status and keep-alive duration deviation value;
Step 1208:Terminal sends PINGREQ messages to server.
As shown in figure 13, by taking keep-alive duration deviation value as an example, process flow diagram flow chart that keep-alive duration of the embodiment of the present invention determines, Comprise the following steps:
Step 1301:Terminal determines that channel keep-alive residual time length is not more than given threshold;
Step 1302:Terminal determines the average packet loss ratio of channel and temporary transient packet loss;
Step 1303:Terminal is according to average packet loss ratio, temporary transient packet loss and average packet loss ratio and the difference of temporary transient packet loss Value determines channel status;
Step 1304:Terminal determines that channel status corresponds to according to channel status and the correspondence of keep-alive duration deviation value Keep-alive duration deviation value;
Step 1305:Terminal sends definite keep-alive duration deviation value and channel status to server;
Step 1306:Server receives the keep-alive duration deviation value and channel status of terminal transmission;
Step 1307:Server is adjusted according to the keep-alive duration of keep-alive duration deviation value and channel status to channel;
Step 1308:Server sends keep-alive and responds to terminal.
Above by reference to the method, apparatus shown according to the embodiment of the present application(System)And/or the frame of computer program product Figure and/or flow chart describe the application.It is to be understood that it can realize that block diagram and/or flow illustrate by computer program instructions One block of figure and the combination of block diagram and/or the block of flowchart illustration.These computer program instructions can be supplied to logical With computer, the processor of special purpose computer and/or other programmable data processing units, to produce machine so that via meter The instruction that calculation machine processor and/or other programmable data processing units perform, which creates, is used for realization block diagram and/or flow chart block In specified function/action method.
Correspondingly, hardware and/or software can also be used(Including firmware, resident software, microcode etc.)To implement the application.More Further, the application can take computer to can be used or the shape of computer program product on computer-readable recording medium Formula, it can be used with the computer realized in media as well or computer readable program code, to be made by instruction execution system With or combined command execution system and use.In the present context, computer can be used or computer-readable medium can be with It is arbitrary medium, it can include, store, communicate, transmit or transmit program, to be made by instruction execution system, device or equipment With, or combined command execution system, device or equipment use.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art God and scope.In this way, if these modifications and changes of the present invention belongs to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising including these modification and variations.

Claims (20)

1. a kind of method that keep-alive duration determines, it is characterised in that this method includes:
Terminal determines that keep-alive adjusts duration according to the channel status of channel;
Definite keep-alive adjustment duration is notified server by the terminal, so that the server adjusts duration according to the keep-alive Keep-alive duration to channel is adjusted.
2. the method as described in claim 1, it is characterised in that a length of keep-alive duration deviation value or keep-alive during the keep-alive adjustment Duration setting value.
3. the method as described in claim 1, it is characterised in that the terminal determines keep-alive according to the channel status of the channel Before adjusting duration, further include:
The terminal determines the average packet loss ratio of channel and temporary transient packet loss;
The terminal is according to the average packet loss ratio, temporarily packet loss and average packet loss ratio and the difference of temporary transient packet loss Determine the channel status of the channel.
4. method as claimed in claim 2, it is characterised in that a length of keep-alive duration deviation value during the keep-alive adjustment;
Definite keep-alive adjustment duration is notified server by the terminal, including:
Definite keep-alive duration deviation value and the channel status are notified server by the terminal so that the server according to The keep-alive duration of the channel status and the keep-alive duration deviation value to the channel is adjusted.
5. method as claimed in claim 3, it is characterised in that the terminal according to the average packet loss ratio, described temporarily lose Bag rate and average packet loss ratio and the difference of temporary transient packet loss determine channel status, including:
If the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, and the terminal determines the letter Road state is error-free state;
If the average packet loss ratio is less than the temporary transient packet loss, and difference is more than second threshold, and the terminal determines the letter Road state is error status.
6. the method as described in Claims 1 to 5 is any, it is characterised in that the terminal is according to the channel status of channel Determine that keep-alive adjusts duration, including:
The terminal determines the corresponding keep-alive of the channel status according to channel status and the correspondence of keep-alive duration deviation value Duration deviation value;Or
The terminal determines the corresponding keep-alive of the channel status according to channel status and the correspondence of keep-alive duration setting value Duration setting value.
7. the method as described in claim 1~6 is any, it is characterised in that the terminal is according to the channel status of channel Before determining keep-alive adjustment duration, further include:
The terminal determines that channel keep-alive residual time length is not more than given threshold.
8. a kind of method that keep-alive duration determines, it is characterised in that this method includes:
Server receives the keep-alive adjustment duration of terminal notification;
The server adjusts keep-alive duration of the duration to channel according to the keep-alive and is adjusted.
9. method as claimed in claim 8, it is characterised in that a length of keep-alive duration deviation value during the keep-alive adjustment;
Before the server is adjusted according to keep-alive duration of the keep-alive adjustment duration to the channel, further include:
The server receives the channel status of terminal notification;
The server adjusts keep-alive duration of the duration to the channel according to the keep-alive and is adjusted, including:
If the channel status is error-free state, the server is by the channel keep-alive duration base value and keep-alive duration deviation value And value be used as channel keep-alive duration;
If the channel status is error status, the server is by the channel keep-alive duration base value and keep-alive duration deviation value Difference as channel keep-alive duration.
10. method as claimed in claim 8, it is characterised in that a length of keep-alive duration setting value during the keep-alive adjustment;
The server adjusts keep-alive duration of the duration to the channel according to the keep-alive and is adjusted, including:
The server is using the keep-alive duration setting value as channel keep-alive duration.
11. the terminal that a kind of keep-alive duration determines, it is characterised in that the terminal includes:
First processing module, for determining that keep-alive adjusts duration according to the channel status of channel;
First transport module, for definite keep-alive adjustment duration to be notified server, so that the server is according to the guarantor Keep-alive duration of the adjustment duration living to channel is adjusted.
12. terminal as claimed in claim 11, it is characterised in that a length of keep-alive duration deviation value or guarantor during the keep-alive adjustment Duration setting value living.
13. terminal as claimed in claim 11, it is characterised in that the first processing module, is additionally operable to:
Determine the average packet loss ratio of the channel and temporary transient packet loss;
According to determining the average packet loss ratio, the temporarily packet loss and average packet loss ratio and the difference of temporary transient packet loss The channel status of channel.
14. terminal as claimed in claim 12, it is characterised in that a length of keep-alive duration deviation value during the keep-alive adjustment;
First transport module, is specifically used for:
Definite keep-alive duration deviation value and the channel status are notified into server, so that the server is according to the channel The keep-alive duration of state and the keep-alive duration deviation value to the channel is adjusted.
15. terminal as claimed in claim 13, it is characterised in that the first processing module, is specifically used for:
If the average packet loss ratio is more than the temporary transient packet loss, and difference is more than first threshold, determines that the channel status is Error-free state;
If the average packet loss ratio is less than the temporary transient packet loss, and difference is more than second threshold, determines that the channel status is Error status.
16. the terminal as described in claim 11~15 is any, it is characterised in that the first processing module, is specifically used for:
According to channel status and the correspondence of keep-alive duration deviation value, determine that the corresponding keep-alive duration of the channel status deviates Value;Or
According to channel status and the correspondence of keep-alive duration setting value, the corresponding keep-alive duration setting of the channel status is determined Value.
17. the terminal as described in claim 11~16 is any, it is characterised in that the first processing module, is additionally operable to:Determine Channel keep-alive residual time length is not more than given threshold.
18. the server that a kind of keep-alive duration determines, it is characterised in that the server includes:
Second transport module, the keep-alive for receiving terminal notification adjust duration;
Second processing module, is adjusted for adjusting keep-alive duration of the duration to channel according to the keep-alive.
19. server as claimed in claim 18, it is characterised in that a length of keep-alive duration deviation value during the keep-alive adjustment;
Second transport module, is additionally operable to:
Receive the channel status of terminal notification;
The Second processing module, is specifically used for:
If the channel status is error-free state, using the channel keep-alive duration base value and keep-alive duration deviation value and be worth as Channel keep-alive duration;
If the channel status is error status, using the difference of the channel keep-alive duration base value and keep-alive duration deviation value as Channel keep-alive duration.
20. server as claimed in claim 18, it is characterised in that a length of keep-alive duration setting value during the keep-alive adjustment;
The Second processing module, is specifically used for:
Using the keep-alive duration setting value as channel keep-alive duration.
CN201610951091.6A 2016-10-26 2016-10-26 The method and terminal that a kind of keep-alive time determines Pending CN107995235A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610951091.6A CN107995235A (en) 2016-10-26 2016-10-26 The method and terminal that a kind of keep-alive time determines

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610951091.6A CN107995235A (en) 2016-10-26 2016-10-26 The method and terminal that a kind of keep-alive time determines

Publications (1)

Publication Number Publication Date
CN107995235A true CN107995235A (en) 2018-05-04

Family

ID=62029397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610951091.6A Pending CN107995235A (en) 2016-10-26 2016-10-26 The method and terminal that a kind of keep-alive time determines

Country Status (1)

Country Link
CN (1) CN107995235A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112272081A (en) * 2020-12-08 2021-01-26 之江实验室 Full-duplex stateful communication protocol method for communication between robot and server
CN113746939A (en) * 2021-09-29 2021-12-03 摩拜(北京)信息技术有限公司 Keep-alive period adjusting method and device and vehicle
CN115866019A (en) * 2023-02-23 2023-03-28 北京中电普华信息技术有限公司 Method and device for determining connection keep-alive time

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101116310A (en) * 2005-02-17 2008-01-30 国际商业机器公司 Apparatus and method for autonomic adjustment of connection keep-alives
US20090106401A1 (en) * 2007-10-22 2009-04-23 Inventec Corporation System and method for Intra Network Internet Protocol (IP) address modification by dual controller
CN101702666A (en) * 2009-11-12 2010-05-05 中兴通讯股份有限公司 Method and system for realizing load balance of media transcoding network and media transcoding units
CN102170399A (en) * 2011-05-17 2011-08-31 中兴通讯股份有限公司 Keep-alive time regulation method, device and system
CN103297461A (en) * 2012-02-28 2013-09-11 中国移动通信集团公司 Setting method of NAT conversation keep-alive time duration and client-side and server
CN103684815A (en) * 2012-09-03 2014-03-26 中国移动通信集团公司 Keep-alive method, device and system for data transmission link
CN104333465A (en) * 2014-10-31 2015-02-04 北京奇虎科技有限公司 Heartbeat interval setting method, device and system
CN105610913A (en) * 2015-12-22 2016-05-25 用友网络科技股份有限公司 Heartbeat keep-alive method and apparatus for long connection in communication network

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101116310A (en) * 2005-02-17 2008-01-30 国际商业机器公司 Apparatus and method for autonomic adjustment of connection keep-alives
US20090106401A1 (en) * 2007-10-22 2009-04-23 Inventec Corporation System and method for Intra Network Internet Protocol (IP) address modification by dual controller
CN101702666A (en) * 2009-11-12 2010-05-05 中兴通讯股份有限公司 Method and system for realizing load balance of media transcoding network and media transcoding units
CN102170399A (en) * 2011-05-17 2011-08-31 中兴通讯股份有限公司 Keep-alive time regulation method, device and system
CN103297461A (en) * 2012-02-28 2013-09-11 中国移动通信集团公司 Setting method of NAT conversation keep-alive time duration and client-side and server
CN103684815A (en) * 2012-09-03 2014-03-26 中国移动通信集团公司 Keep-alive method, device and system for data transmission link
CN104333465A (en) * 2014-10-31 2015-02-04 北京奇虎科技有限公司 Heartbeat interval setting method, device and system
CN105610913A (en) * 2015-12-22 2016-05-25 用友网络科技股份有限公司 Heartbeat keep-alive method and apparatus for long connection in communication network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴亦川 等: ""一种自适应的健壮TCP/IP 报头压缩算法"", 《计算机研究与发展》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112272081A (en) * 2020-12-08 2021-01-26 之江实验室 Full-duplex stateful communication protocol method for communication between robot and server
CN113746939A (en) * 2021-09-29 2021-12-03 摩拜(北京)信息技术有限公司 Keep-alive period adjusting method and device and vehicle
CN115866019A (en) * 2023-02-23 2023-03-28 北京中电普华信息技术有限公司 Method and device for determining connection keep-alive time
CN115866019B (en) * 2023-02-23 2023-05-12 北京中电普华信息技术有限公司 Method and device for determining connection keep-alive time

Similar Documents

Publication Publication Date Title
US10631144B2 (en) Method and device for charging traffic data flow of user equipment
CN107645529B (en) Heartbeat packet sending method and device
CN103650623A (en) Transmission of short packet data messages via a signaling radio bearer
CN108696950B (en) Session reestablishment method and device, AMF (advanced metering framework), SMF (simple message service) and terminal
US9100160B2 (en) Apparatus and method for small data transmission in 3GPP-LTE systems
CN108632882B (en) Code rate control method, PCF entity, AMF entity and SMF entity
EP2858332A1 (en) Method and device for establishing a connection
CN107995235A (en) The method and terminal that a kind of keep-alive time determines
CN103929784B (en) A kind of user bandwidth control method, apparatus and system
CN106789394A (en) A kind of connection server keep Alive Packet control method long and system
CN110061820B (en) Address sending method and device, storage medium and electronic device
Chan et al. Assessing network energy consumption of mobile applications
CN107294830B (en) A kind of data transmission method and system
CN113194550A (en) Data channel construction method, server and data cluster system
CN103516766A (en) Method and system of communication between client-side and application server
CN115002238A (en) Traffic transmission method, device, equipment and storage medium
CN104348645A (en) Server and data transmission method of server
CN110740197A (en) core network equipment, core network system and communication method
CN111698677A (en) Method for reporting and receiving user plane statistical information and network equipment
CN106686693A (en) System information transmission method and device
RU2496260C2 (en) Method, base station controller and base station subsystem for monitoring quality of service
CN103685071A (en) Network source distributing method and device
CN103731323A (en) Method and device for monitoring service traffic of mobile Internet
CN109905419A (en) A kind of method and apparatus of data transmission
KR101274774B1 (en) System and method for providing push service using reconnection message

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180504

RJ01 Rejection of invention patent application after publication