CN106411627A - Network connection detection method and apparatus - Google Patents

Network connection detection method and apparatus Download PDF

Info

Publication number
CN106411627A
CN106411627A CN201510466346.5A CN201510466346A CN106411627A CN 106411627 A CN106411627 A CN 106411627A CN 201510466346 A CN201510466346 A CN 201510466346A CN 106411627 A CN106411627 A CN 106411627A
Authority
CN
China
Prior art keywords
scene type
time
heartbeat packet
real
time interval
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
CN201510466346.5A
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.)
Burson Marsteller Network Game Development (shenzhen) Co Ltd
Original Assignee
Burson Marsteller Network Game Development (shenzhen) 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 Burson Marsteller Network Game Development (shenzhen) Co Ltd filed Critical Burson Marsteller Network Game Development (shenzhen) Co Ltd
Priority to CN201510466346.5A priority Critical patent/CN106411627A/en
Publication of CN106411627A publication Critical patent/CN106411627A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a network connection detection method comprising: identifying a current scenario type; determining a time interval of sent heartbeat packets corresponding to the recognized scenario type, wherein the time interval varies with a preset rule corresponding to the scenario type; when a data packet sent by a server is not received within the time interval, transmitting heartbeat packets to the server; determining whether or not data packets returned by the server according to the heartbeat packets has been received within a preset time after the heartbeat packets are transmitted; if yes, determining that the connection with the server is kept; otherwise, determining that the connection with the server has been cut. The method can monitor a network connection status in real time and reduce a flow rate effectively. There is also provided a network connection detection apparatus.

Description

Network connection detection method and device
Technical field
The present invention relates to technical field of the computer network, more particularly to a kind of network connection detection method and dress Put.
Background technology
With the development of development of Mobile Internet technology, entertained by mobile terminal and work is had become as people Important content in life.Network is kept to continue reliably to connect and also just become people's concern.Tradition Mode, be by mobile terminal to server send heartbeat packet, and the reception server return heartbeat packet come Determine that this mobile terminal preserves to connect.But frequently send the flow that heartbeat packet can waste mobile terminal, the heart Jump the state that just cannot real-time monitor network connection very little that bag sends.Therefore, how to real-time monitor net Network connection status effectively reduction flow consumption become the current technical problem needing and solving.
Content of the invention
Based on this it is necessary to be directed to above-mentioned technical problem, provide one kind being capable of real time monitoring network connection status And effectively reduce network connection detection method and the device that flow consumes.
A kind of network connection detection method, methods described includes:
Identify the scene type being presently in;
Determine the corresponding time interval sending heartbeat packet of identified scene type, described time interval is pressed According to the change of scene type corresponding preset rules;
When not receiving the packet that server sends in described time interval, send heartbeat packet to server;
Judge whether receive described server according to the described heart in the Preset Time after sending described heartbeat packet Jump the packet that bag returns;
If it is determined that keeping being connected with described server;
Otherwise it is determined that disconnecting with described server.
A kind of network connection detection means, described device includes:
Identification module, for identifying the scene type being presently in;
Determining module, for determining the time interval of the identified corresponding heartbeat packet of scene type, described The time interval of heartbeat packet changes according to the corresponding preset rules of described scene type;
Sending module, for not receiving the packet of server transmission in the time interval of described heartbeat packet When, send heartbeat packet to server;
Judge module, for judging whether receive described clothes in the Preset Time after sending described heartbeat packet The packet that business device returns according to described heartbeat packet;
If described determining module is additionally operable to receive server in described Preset Time and is returned according to described heartbeat packet The packet returning is it is determined that keep being connected with described server;
If described determining module is additionally operable to not receive server in described Preset Time according to described heartbeat packet The packet returning is it is determined that disconnect with described server.
Above-mentioned network connection detection method and device, identify the scene type being presently in;Determine and identified The corresponding time interval sending heartbeat packet of scene type, time interval is corresponding default according to scene type Rule change;When not receiving the packet that server sends in the time interval, send heart beating to server Bag;Judge whether receive, in the Preset Time after sending heartbeat packet, the number that server returns according to heartbeat packet According to bag;If it is determined that keeping being connected with server;Otherwise it is determined that disconnecting with server. Time interval due to sending from heartbeat packet to server is to be determined according to the scene type being presently in.And And the time interval of heartbeat packet can also be changed according to the corresponding preset rules of scene type, so that The time interval of the corresponding heartbeat packet of different scenes type is different, thus overcoming traditional transmission heartbeat packet Time interval immobilizes and leads to heartbeat packet to send excessively frequent or very few problem.Thus according to scene Type determines that the time interval sending heartbeat packet can real-time monitor network connection state, and effectively reduces Flow consumption.
Brief description
Fig. 1 is the applied environment figure of network connection detection method in an embodiment;
Fig. 2 is the flow chart of network connection detection method in an embodiment;
Fig. 3 is the structural representation of network connection detection means in an embodiment;
Fig. 4 is the structural representation of network connection detection means in another embodiment;
Fig. 5 is the structural representation of network connection detection means in further embodiment.
Specific embodiment
The network connection detection method that the embodiment of the present invention is provided is applied in applied environment as shown in Figure 1. Terminal 102 is connected with server 104 by network.Terminal includes smart mobile phone, panel computer, individual Notebook computer and personal digital assistant etc..Can be with several scenes type in terminal 102, different scenes type The time interval sending heartbeat packet is different.Every kind of scene type all has corresponding preset rules, can will send out The time interval sending heartbeat packet is increased.Terminal 102 after identifying the scene type being presently in, really The time interval of this scene type fixed corresponding transmission heartbeat packet.Terminal 102 is in this time interval if connect Receive any packet of server 104 transmission, all represent the network between terminal 102 and server 104 Keep connecting.Terminal 102 in this time interval without receive server 104 transmission packet, Then send heartbeat packet to server 104.If terminal 102 receives in the Preset Time sending heartbeat packet The packet that server 104 returns after responding heartbeat packet is it is determined that between terminal 102 and server 104 Network keeps connecting, otherwise it is determined that the network between terminal 102 and server 104 disconnects. After network holding connection is detected, terminal 102 increases transmission according to preset rules corresponding with scene type The time interval of heartbeat packet, and send heartbeat packet to server 104 again.Keep connecting network is detected Afterwards, mobile terminal 1 02 increases the time interval sending heartbeat packet again, until increasing to and scene type pair The higher limit answered.Because the time interval that terminal 102 sends heartbeat packet to server 104 is according to current institute The scene type at place is determining.And the time interval of heartbeat packet can also be corresponding pre- according to scene type If rule is changed, so that the time interval of the corresponding heartbeat packet of different scenes type is different, thus The time interval overcoming traditional transmission heartbeat packet immobilize and lead to heartbeat packet send excessively frequently or Very few problem.Determine that the time interval sending heartbeat packet can real-time monitor net thus according to scene type Network connection status, and effectively reduce flow consumption.
In one embodiment, as shown in Figure 2, there is provided a kind of network connection detection method, in this way Illustrate as a example being applied to terminal, the method specifically includes:
Step 202, identifies the scene type being presently in.
Scene type can have multiple.Different scene type is different to the requirement of real-time of information.Information The information changing when real-time refers to that information changes can synchronously be learned.Scene type can be wrapped Include the high scene type of real-time and the low scene type of real-time.
Step 204, determines the corresponding time interval sending heartbeat packet of identified scene type, between the time Every according to the change of scene type corresponding preset rules.
Different scene type is pre-set with time interval initial value and the heart beating of different transmission heartbeat packet The preset rules of bag.The corresponding time interval initial value sending heartbeat packet of the high scene type of real-time is less than The corresponding time interval initial value sending heartbeat packet of the low scene type of real-time.For example, real-time is high Scene type can arrange the time interval initial value of shorter transmission heartbeat packet, such as 6s, the low field of real-time Scape type can arrange the time interval initial value of longer transmission heartbeat packet, such as 10s.Every kind of scene type pair The time interval of the transmission heartbeat packet answered can be changed according to preset rules on the basis of initial value.Root To determine according to scene type send heartbeat packet time interval, thus avoid traditional transmission heartbeat packet when Between interval immobilize and lead to heartbeat packet to send excessively frequent or very few situation.
Step 206, when not receiving the packet that server sends in this time interval, sends to server Heartbeat packet.
After terminal with server successful connection, the scene type according to being presently in calls first timer letter Number.Detect that using first timer function whether receiving server in the time interval send heartbeat packet sends out The packet sending.If receiving any packet of server transmission in the time interval sending heartbeat packet Then represent that current and server is in connection status.The packet that server sends can be that heartbeat packet can also It is the other information interacting with terminal.If not receiving service in the time interval sending heartbeat packet The packet that device sends, then terminal to server transmission heartbeat packet, calls timeout treatment function simultaneously.Pass through Whether timeout treatment function check receives the packet of server return in Preset Time.
Step 208, judges whether receive server according to heartbeat packet in the Preset Time after sending heartbeat packet The packet returning;If so, then enter step 210, otherwise, then enter step 212.
If the network between terminal and server keeps being connected, server, after receiving heartbeat packet, can ring Should heartbeat packet, and returned data bag in Preset Time.Specifically, can be to return heartbeat packet, also may be used To be to return the other information interacting with terminal.Preset Time can be than the time interval sending heartbeat packet Short.For example, the time interval sending heartbeat packet is 6s, and Preset Time is 5s.
Step 210, determines and keeps being connected with server.
Step 212, is determined and is disconnected with server.
If any packet not receiving server return in Preset Time is it is determined that terminal and service Network connection between device disconnects.Call timeout callback function, stop detection network state.
In the present embodiment, identify the scene type being presently in;Determine that identified scene type is corresponding Send the time interval of heartbeat packet, time interval changes according to the corresponding preset rules of scene type;In the time When not receiving the packet that server sends in interval, send heartbeat packet to server;Judge sending the heart Jump in the Preset Time after bag and whether receive the packet that server returns according to heartbeat packet;If so, then true Determine to keep being connected with server;Otherwise it is determined that disconnecting with server.Due to sending to server The time interval of heartbeat packet is to be determined according to the scene type being presently in.And between the time of heartbeat packet Every being changed according to the corresponding preset rules of scene type, so that different scenes type corresponds to Heartbeat packet time interval different, thus the time interval overcoming traditional transmission heartbeat packet immobilizes And lead to heartbeat packet to send excessively frequent or very few problem.Determine thus according to scene type and send heart beating The time interval of bag can real-time monitor network connection state, and effectively reduces flow consumption.
In one embodiment, before the step of the scene type that identification is presently in, also include:Show The interface of multiple scenes;Obtain the scene type that user selects at this interface;The scene that record is selected with user Type corresponding scene state value;Identify that the step of the scene type being presently in includes:According to scene state Value determines the scene type that user is presently in.
In the present embodiment, terminal can show the interface of multiple scenes.Specifically, can be by pacifying in terminal The interface to show multiple scenes for the application program of dress.Further, can by same application program Lai Show the interface of multiple scenes it is also possible to show the interface of different scenes by different application programs. Plurality of scene can concentrate in an interface it is also possible to be distributed in different interfaces.Each scene Type all has default scene state value.The scene type corresponding scene state value that user is selected is carried out Record, determines, thus, it is possible to the scene state value according to record, the scene type that user is presently in.From And the time interval of heartbeat packet can be determined according to scene type.
In one embodiment, after determining the step being connected with server holding, also include:According to The corresponding preset rules of scene type increase the time interval sending heartbeat packet;Repeat in the time interval When not receiving the packet that server sends, to the step of server transmission heartbeat packet, until sending heart beating The time interval of bag is increased to higher limit corresponding with scene type.
In the present embodiment, every kind of scene type is both provided with increasing the default rule of the time interval sending heartbeat packet Then.Preset rules can be as initial value in the first time interval sending heartbeat packet, determine terminal with After network between server keeps connecting, increase the time interval of preset percentage with this initial value for radix Value is as the time interval sending heartbeat packet next time.Upper once send heartbeat packet after confirm terminal and service After network between device keeps connecting, increased pre- again for radix with the time interval sending heartbeat packet next time If the time interval value of percentage ratio, the time interval sending heartbeat packet is gradually increased with this.Namely with first As initial value, using n as power exponent, by initial value *, (1+ presets percentage to the time interval sending heartbeat packet Than)nAs the time interval of nth transmission heartbeat packet, until increasing to the corresponding higher limit of scene type. The wherein corresponding initial value scene type pair lower than real-time sending heartbeat packet of the high scene type of real-time The initial value of the transmission heartbeat packet answered is low, and the corresponding preset percentage of the high scene type of real-time compares real-time The corresponding preset percentage of high scene type is low, and the high scene type of real-time corresponding higher limit ratio The corresponding higher limit of the low scene type of real-time is low.For example, corresponding of the high scene type of real-time The initial value sending heartbeat packet is 6s, and preset percentage is 5%, and higher limit is 12s, then send heart beating second The time interval of bag is 6+6*5%=6.3s.The corresponding initial value sending heartbeat packet of the low scene type of real-time For 10s, preset percentage is 10%, and higher limit is 40s, then the time interval that second sends heartbeat packet is 10+10*10%=11s.Thus, it is possible to by corresponding for high for the real-time scene type time interval sending heartbeat packet The corresponding time interval sending heartbeat packet of the scene type low with real-time effectively makes a distinction, and then can Difference real-time monitoring terminal and server in the scene type high with real-time in the low scene type of real-time Between network connection state, and progressively will send heartbeat packet time interval increase, thus effectively save draw The flow consumption of dynamic terminal.
In one embodiment, scene type includes the high scene type of real-time and the low scene class of real-time Type, after determining the step being connected with server holding, is also included:When the scene type high from real-time When switching to the low scene type of real-time, judge the corresponding heartbeat packet that sends of the high scene type of real-time The corresponding time interval sending heartbeat packet of whether low more than the real-time scene type of time interval;If so, Then using the corresponding time interval sending heartbeat packet of the high scene type of real-time as the low scene class of real-time The corresponding initial interval sending heartbeat packet of type;Repeat and do not receive server in the time interval During the packet sending, to the step of server transmission heartbeat packet;Corresponding by the low scene type of real-time Preset rules increase send heartbeat packet time interval until increase to the low scene type of real-time corresponding on Limit value.
In the present embodiment, scene type can arbitrarily switch.Because the time of scene type switching is extremely short, consumption When be Millisecond, therefore can not need when scene type switch detection network whether connect.When user from When the high scene type of real-time switches to real-time low scene type, also imply that and send heartbeat packet Time interval may shorten.The high corresponding transmission of scene type of real-time before now needing to judge switching Whether low more than the real-time after the switching scene type corresponding transmission heartbeat packet of the time interval of heartbeat packet Time interval, specifically, can be by scene type corresponding transmission heartbeat packet high for the real-time before switching The time interval time interval that send heartbeat packet corresponding with the low scene type of real-time after switching default Initial value is compared.
Network due to having been acknowledged before switching in scene type between terminal and server keeps being connected, such as The corresponding time interval sending heartbeat packet of the high scene type of real-time before fruit switching is more than the reality after switching The preset initial value of the corresponding time interval sending heartbeat packet of the low scene type of when property, can be by before switching The corresponding time interval sending heartbeat packet of the high scene type of real-time is as the low scene of real-time after switching The corresponding initial interval sending heartbeat packet of type.It is pre- after heartbeat packet is sent with initial interval If receiving server in the time to respond after the packet that heartbeat packet returns it is determined that between terminal and server Network keep connect.And increase by the low corresponding preset rules of scene type of real-time and send heartbeat packet Time interval until increasing to the corresponding higher limit of the low scene type of real-time.Due to real-time after switching The initial interval of low scene type corresponding transmission heartbeat packet is higher than preset initial value, so that Between after switching, the time interval of the low scene type of real-time corresponding transmission first heartbeat packet is than the default time Every will grow, and then so that real-time after switching after increase the time interval sending heartbeat packet according to preset rules Low scene type sends the time interval of heartbeat packet every time and default time interval will be grown.Therefore, it is possible to The Flux Loss of terminal can also be reduced further during real time monitoring network connection status.
If the corresponding time interval sending heartbeat packet of the high scene type of the real-time before switching is less than switching The preset initial value of the corresponding time interval sending heartbeat packet of the low scene type of rear real-time, then adopt The preset initial value conduct of the corresponding time interval sending heartbeat packet of the low scene type of the real-time after switching Send the initial interval of heartbeat packet.Connect in Preset Time after heartbeat packet is sent with initial interval Receive after server responds the packet that heartbeat packet returns it is determined that the network between terminal and server keeps Connect.And increase, by the low corresponding preset rules of scene type of real-time, the time interval sending heartbeat packet Until increasing to the corresponding higher limit of the low scene type of real-time.Can to obtain after scene type switching A ratio sends the long time interval of time interval of heartbeat packet before scene type switching such that it is able in reality When monitoring network connection status when can also reduce the Flux Loss of terminal further.
In one embodiment, scene type includes the high scene type of real-time and the low scene class of real-time Type, after determining the step being connected with server holding, is also included:When the scene type low from real-time When switching to the high scene type of real-time, judge the corresponding heartbeat packet that sends of the low scene type of real-time The upper limit of the corresponding time interval sending heartbeat packet of whether high more than the real-time scene type of time interval Value;If so, then obtain the corresponding time interval sending heartbeat packet of the high scene type of real-time to preset initially Value;Otherwise, using corresponding for scene type low for the real-time time interval sending heartbeat packet as real-time height Scene type corresponding send heartbeat packet initial interval;Repeat and do not receive in the time interval To server send packet when, to server send heartbeat packet step;By the high scene class of real-time The corresponding preset rules of type increase the time interval sending heartbeat packet until increasing to the high scene type of real-time Corresponding higher limit.
In the present embodiment, when user switches to the high scene type of real-time from the low scene type of real-time, Also imply that the time interval sending heartbeat packet may lengthen.Now need the real-time before judging switching Whether the corresponding time interval sending heartbeat packet of low scene type is more than the high scene class of real-time after switching The higher limit of the corresponding time interval sending heartbeat packet of type.If it is, it is real-time before representing using switching Property the corresponding time interval sending heartbeat packet of low scene type do not met the high field of real-time after switching The requirement of scape type detection network connection state, needs to obtain the high scene type corresponding transmission heart of real-time Jump the time interval preset initial value of bag.Otherwise then it represents that adopting the low scene type of the real-time before switching After the corresponding time interval sending heartbeat packet can meet switching, the high scene type detection network of real-time connects Connect the requirement of state, can using corresponding for scene type low for real-time send heartbeat packet time interval as The corresponding initial interval sending heartbeat packet of the high scene type of real-time.
Server response heartbeat packet is received in Preset Time after heartbeat packet is sent with this initial interval It is determined that the network between terminal and server keeps being connected after the packet returning.And it is high by real-time The corresponding preset rules of scene type increase send heartbeat packet time interval high until increasing to real-time The corresponding higher limit of scene type.By the corresponding time interval sending heartbeat packet of scene type low for real-time As the corresponding initial interval sending heartbeat packet of the high scene type of real-time so that after switching in real time Property the corresponding initial interval sending heartbeat packet of high scene type higher than preset initial value so that After must switching, the corresponding time interval of heartbeat packet that sends first of the high scene type of real-time is than the default time Interval will be grown, and then so that after switching in real time after increase the time interval sending heartbeat packet according to preset rules The high scene type of property sends the time interval of heartbeat packet every time and default time interval will be grown.Therefore, it is possible to The Flux Loss of terminal can also be reduced in real time monitoring network connection status further.
Further, scene type can include multiple, such as scene type in real-time etc..Can be Repeatedly switched in multiple scene type, after switching every time, all can be compared using aforesaid way, with Just a time interval longer than the preset initial value sending heartbeat packet can be obtained after scene type switching, So as to can also reduce the Flux Loss of terminal further in real time monitoring network connection status.
In one embodiment, until send heartbeat packet time interval be increased to corresponding with scene type The step of higher limit after, also include:Higher limit is defined as scene type corresponding transmission heartbeat packet Fixed Time Interval;When not receiving the packet that server sends in Fixed Time Interval, to server Send heartbeat packet;Judge whether receive server according to heartbeat packet in the Preset Time after sending heartbeat packet The packet returning;If it is determined that keeping being connected with server;Otherwise it is determined that disconnected with server Open connection.
In the present embodiment, it is increased to higher limit corresponding with scene type in the time interval sending heartbeat packet Step after, if do not carry out scene type switching, terminal is using this higher limit as sending heartbeat packet Fixed Time Interval, and send heartbeat packet to detect whether network keeps to server with this Fixed Time Interval Connect.If after handoff scenario type, can will switching after the corresponding higher limit of scene type as send out Send the Fixed Time Interval of heartbeat packet.Specifically, when the scene type high from real-time, to switch to real-time low Scene type when, using corresponding for scene type low for real-time higher limit as send heartbeat packet fixing when Between be spaced, and with this Fixed Time Interval to server send heartbeat packet to detect network whether keep connect. When the scene type low from real-time switches to the high scene type of real-time, by scene class high for real-time The corresponding higher limit of type as the Fixed Time Interval sending heartbeat packet, and with this Fixed Time Interval to service Device sends heartbeat packet to detect whether network keeps connecting.
Further, if multiple handoff scenario type, the scene type pair after last being switched The higher limit answered is as the Fixed Time Interval sending heartbeat packet, and is sent out to server with this Fixed Time Interval Heartbeat packet is sent to detect whether network keeps connecting.
In one embodiment, as shown in Figure 3, there is provided a kind of network connection detection means, this device bag Include:Identification module 302, determining module 304, sending module 306 and judge module 308, wherein:
Identification module 302, for identifying the scene type being presently in.
Determining module 304, for determining the time interval of the identified corresponding heartbeat packet of scene type, the heart The time interval jumping bag changes according to the corresponding preset rules of scene type.
Sending module 306, for not receiving the packet of server transmission in the time interval of heartbeat packet When, send heartbeat packet to server.
Judge module 308, for judging whether receive service in the Preset Time after sending described heartbeat packet The packet that device returns according to heartbeat packet.
If determining module 304 is additionally operable to receive the data that server returns according to heartbeat packet in Preset Time Bag is it is determined that keep being connected with server.
If determining module 304 is additionally operable to not receive the number that server returns according to heartbeat packet in Preset Time According to bag it is determined that disconnecting with server.
In one embodiment, as shown in figure 4, this device also includes:Display module 310, acquisition module 312 and logging modle 314, wherein:
Display module 310, for showing the interface of multiple scenes.
Acquisition module 312, for obtaining the scene type that user selects at interface.
Logging modle 314, the scene type corresponding scene state value selecting with user for record.
Identification module 302 is additionally operable to determine, according to scene state value, the scene type that user is presently in.
In one embodiment, as shown in figure 5, this device also includes:Increase module 316, for according to The corresponding preset rules of scene type increase the time interval sending heartbeat packet;Provide module 306 and be additionally operable to weight When multiple execution does not receive the packet of server transmission in the time interval, send heartbeat packet to server Step;Increase module 316 be additionally operable to by send heartbeat packet time interval be increased to corresponding with scene type Higher limit.
In one embodiment, scene type includes the high scene type of real-time and the low scene class of real-time Type, judge module 308 is additionally operable to work as and switches to the low scene type of real-time from the high scene type of real-time When, judge whether the corresponding time interval sending heartbeat packet of the high scene type of real-time is more than real-time low Scene type corresponding send heartbeat packet time interval;If it is high that determining module 304 is additionally operable to real-time The corresponding time interval sending heartbeat packet of scene type is more than the low scene type corresponding transmission heart of real-time Jump bag time interval, then using the high scene type of real-time corresponding send heartbeat packet time interval as The corresponding initial interval sending heartbeat packet of the low scene type of real-time;Sending module 306 is additionally operable to Repeat do not receive in the time interval server transmission packet when, to server send heartbeat packet Step;Increase module 316 to be additionally operable to increase transmission by the corresponding preset rules of the low scene type of real-time The time interval of heartbeat packet is until increasing to the corresponding higher limit of the low scene type of real-time.
In one embodiment, scene type includes the high scene type of real-time and the low scene class of real-time Type, judge module 308 is additionally operable to work as and switches to the high scene type of real-time from the low scene type of real-time When, judge the corresponding time interval sending heartbeat packet of the low scene type of real-time whether more than real-time height Scene type corresponding send heartbeat packet time interval higher limit;If acquisition module 312 is additionally operable to real The corresponding time interval sending heartbeat packet of the low scene type of when property is more than the high scene type of real-time and corresponds to The time interval of transmission heartbeat packet higher limit, then obtain the high scene type corresponding transmission heart of real-time Jump the time interval initial value of bag;If determining module 304 is additionally operable to corresponding of the low scene type of real-time The time interval sending heartbeat packet is less than the corresponding time interval sending heartbeat packet of the high scene type of real-time Higher limit, will be high as real-time for the time interval of corresponding for scene type low for real-time transmission heartbeat packet The corresponding initial interval sending heartbeat packet of scene type;Sending module 306 is additionally operable to repeat When not receiving the packet that server sends in time interval, to the step of server transmission heartbeat packet;Increase Plus module 316 be additionally operable to by the corresponding preset rules of the high scene type of real-time increase send heartbeat packet when Between be spaced until increasing to the corresponding higher limit of the high scene type of real-time.
In one embodiment, determining module 304 is additionally operable to for higher limit to be defined as corresponding of scene type Send the Fixed Time Interval of heartbeat packet;Sending module 306 is additionally operable to not receive clothes in Fixed Time Interval During the packet that business device sends, send heartbeat packet to server;Judge module 308 is additionally operable to judge sending The packet that server returns whether is received according to heartbeat packet in Preset Time after described heartbeat packet;Determine If module 304 is additionally operable to receive the packet that server returns according to described heartbeat packet in Preset Time, Then determine and keep being connected with server;If determining module 304 is additionally operable to not receive service in Preset Time The packet that device returns according to described heartbeat packet is it is determined that disconnect with server.
Each technical characteristic of embodiment described above can arbitrarily be combined, for making description succinct, not right The all possible combination of each technical characteristic in above-described embodiment is all described, as long as however, these skills There is not contradiction in the combination of art feature, be all considered to be the scope of this specification record.
Embodiment described above only have expressed the several embodiments of the present invention, and its description is more concrete and detailed, But can not therefore be construed as limiting the scope of the patent.It should be pointed out that for this area For those of ordinary skill, without departing from the inventive concept of the premise, can also make and some deform and change Enter, these broadly fall into protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be with appended power Profit requires to be defined.

Claims (10)

1. a kind of network connection detection method, methods described includes:
Identify the scene type being presently in;
Determine the corresponding time interval sending heartbeat packet of identified scene type, described time interval is pressed According to the change of scene type corresponding preset rules;
When not receiving the packet that server sends in described time interval, send heartbeat packet to server;
Judge whether receive described server according to the described heart in the Preset Time after sending described heartbeat packet Jump the packet that bag returns;
If it is determined that keeping being connected with described server;
Otherwise it is determined that disconnecting with described server.
2. method according to claim 1 is it is characterised in that the scene that is presently in described identification Before the step of type, also include:
Show the interface of multiple scenes;
Obtain the scene type that user selects at described interface;
The scene type corresponding scene state value that record is selected with described user;
The step of the scene type that described identification is presently in includes:User is determined according to described scene state value The scene type being presently in.
3. method according to claim 2 is it is characterised in that determine and described server guarantor described After holding the step of connection, also include:
Increase the time interval sending heartbeat packet according to preset rules corresponding with described scene type;
When repeating the described packet not receiving server transmission in described time interval, to service The step that device sends heartbeat packet, the time interval until sending heartbeat packet is increased to corresponding with scene type Higher limit.
4. method according to claim 3 is it is characterised in that described scene type includes real-time height Scene type and the low scene type of real-time, in the described step determining and being connected with the holding of described server Afterwards, also include:
When the scene type high from real-time switches to the low scene type of real-time, judge described real-time Whether the corresponding time interval sending heartbeat packet of high scene type is more than the low scene type of described real-time The corresponding time interval sending heartbeat packet;
If so, then using the corresponding time interval sending heartbeat packet of the high scene type of described real-time as institute State the corresponding initial interval sending heartbeat packet of the low scene type of real-time;
Repeat do not receive in described time interval server transmission packet when, send out to server The step sending heartbeat packet;
The time interval increasing transmission heartbeat packet by the corresponding preset rules of the low scene type of described real-time is straight To increasing to the corresponding higher limit of the low scene type of described real-time.
5. method according to claim 3 is it is characterised in that described scene type includes real-time height Scene type and the low scene type of real-time, in the described step determining and being connected with the holding of described server Afterwards, also include:
When the scene type low from real-time switches to the high scene type of real-time, judge described real-time Whether the corresponding time interval sending heartbeat packet of low scene type is more than the high scene type of described real-time The higher limit of the corresponding time interval sending heartbeat packet;
If so, the time interval then obtaining the high scene type of described real-time corresponding transmission heartbeat packet is initial Value;
Otherwise, using corresponding for scene type low for the described real-time time interval sending heartbeat packet as described The corresponding initial interval sending heartbeat packet of the high scene type of real-time;
Repeat do not receive in described time interval server transmission packet when, send out to server The step sending heartbeat packet;
The time interval increasing transmission heartbeat packet by the corresponding preset rules of the high scene type of described real-time is straight To increasing to the corresponding higher limit of the high scene type of described real-time.
6. method according to claim 3 it is characterised in that described until send heartbeat packet when Between interval be increased to higher limit corresponding with scene type step after, also include:
Described higher limit is defined as the corresponding Fixed Time Interval sending heartbeat packet of scene type;
When not receiving the packet that server sends in described Fixed Time Interval, send the heart to server Jump bag;
Judge whether receive described server according to the described heart in the Preset Time after sending described heartbeat packet Jump the packet that bag returns;
If it is determined that keeping being connected with described server;
Otherwise it is determined that disconnecting with described server.
7. a kind of network connection detection means is it is characterised in that described device includes:
Identification module, for identifying the scene type being presently in;
Determining module, for determining the time interval of the identified corresponding heartbeat packet of scene type, described The time interval of heartbeat packet changes according to the corresponding preset rules of described scene type;
Sending module, for not receiving the packet of server transmission in the time interval of described heartbeat packet When, send heartbeat packet to server;
Judge module, for judging whether receive described clothes in the Preset Time after sending described heartbeat packet The packet that business device returns according to described heartbeat packet;
If described determining module is additionally operable to receive server in described Preset Time and is returned according to described heartbeat packet The packet returning is it is determined that keep being connected with described server;
If described determining module is additionally operable to not receive server in described Preset Time according to described heartbeat packet The packet returning is it is determined that disconnect with described server.
8. device according to claim 7 is it is characterised in that described device also includes:
Display module, for showing the interface of multiple scenes;
Acquisition module, for obtaining the scene type that user selects at described interface;
Logging modle, the scene type corresponding scene state value selecting with described user for record;
Described identification module is additionally operable to determine, according to described scene state value, the scene type that user is presently in.
9. device according to claim 8 is it is characterised in that described device also includes:
Increase module, for according to preset rules corresponding with described scene type increase send heartbeat packet when Between be spaced;
Described granting module is additionally operable to repeat the described server that do not receive in described time interval and sends Packet when, to server send heartbeat packet step;
Described increase module be additionally operable to by send heartbeat packet time interval be increased to corresponding with scene type Higher limit.
10. device according to claim 9 is it is characterised in that described scene type includes real-time High scene type and the low scene type of real-time, described judge module is additionally operable to when from the high field of real-time When scape type switches to real-time low scene type, judge corresponding of the high scene type of described real-time Send heartbeat packet whether low more than the described real-time scene type of time interval corresponding send heartbeat packet when Between be spaced;
If described determining module is additionally operable to the high scene type of the described real-time corresponding time sending heartbeat packet The corresponding time interval sending heartbeat packet of the interval scene type low more than described real-time, then with described reality The corresponding time interval sending heartbeat packet of scene type of Shi Xinggao is as the low scene type of described real-time The corresponding initial interval sending heartbeat packet;
Described sending module is additionally operable to repeat the number not receiving server transmission in described time interval During according to bag, the step sending heartbeat packet to server;
Described increase module is additionally operable to increase by the corresponding preset rules of the low scene type of described real-time and sends The time interval of heartbeat packet is until increasing to the corresponding higher limit of the low scene type of described real-time.
CN201510466346.5A 2015-07-31 2015-07-31 Network connection detection method and apparatus Pending CN106411627A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510466346.5A CN106411627A (en) 2015-07-31 2015-07-31 Network connection detection method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510466346.5A CN106411627A (en) 2015-07-31 2015-07-31 Network connection detection method and apparatus

Publications (1)

Publication Number Publication Date
CN106411627A true CN106411627A (en) 2017-02-15

Family

ID=58007608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510466346.5A Pending CN106411627A (en) 2015-07-31 2015-07-31 Network connection detection method and apparatus

Country Status (1)

Country Link
CN (1) CN106411627A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106850355A (en) * 2017-02-24 2017-06-13 上海微喂网络科技有限公司 Apply the full-time monitoring intelligent heartbeat method in real-time intercommunication network
CN106936668A (en) * 2017-05-08 2017-07-07 深圳市立昌机电设备有限公司 The instrument operating condition monitoring method and system of coil winding machine
CN106972977A (en) * 2017-05-24 2017-07-21 北京潘达互娱科技有限公司 The long connection maintaining method of one kind and device
CN107249136A (en) * 2017-06-07 2017-10-13 北京潘达互娱科技有限公司 Method for connecting network and device
CN107819648A (en) * 2017-11-14 2018-03-20 新华三技术有限公司 Network configuration NETCONF connecting detection method and apparatus
WO2018205110A1 (en) * 2017-05-08 2018-11-15 深圳市立昌机电设备有限公司 Method and system for monitoring working state of winding machine
CN113890894A (en) * 2021-10-19 2022-01-04 平安普惠企业管理有限公司 Keep-alive method and device for client communication link, electronic equipment and storage medium
CN117336213A (en) * 2023-12-01 2024-01-02 四川才子软件信息网络有限公司 Subsystem monitoring method, system and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102638417A (en) * 2012-03-27 2012-08-15 广州市动景计算机科技有限公司 Information communication method, device and system
CN103501251A (en) * 2013-10-11 2014-01-08 北京奇虎科技有限公司 Method and device for processing data packet under offline condition
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104144159A (en) * 2014-06-26 2014-11-12 腾讯科技(深圳)有限公司 Intelligent heartbeat keeping method and system
CN104412649A (en) * 2014-06-18 2015-03-11 华为技术有限公司 Heartbeat adjusting method, device and terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102638417A (en) * 2012-03-27 2012-08-15 广州市动景计算机科技有限公司 Information communication method, device and system
CN103501251A (en) * 2013-10-11 2014-01-08 北京奇虎科技有限公司 Method and device for processing data packet under offline condition
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104412649A (en) * 2014-06-18 2015-03-11 华为技术有限公司 Heartbeat adjusting method, device and terminal
CN104144159A (en) * 2014-06-26 2014-11-12 腾讯科技(深圳)有限公司 Intelligent heartbeat keeping method and system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106850355A (en) * 2017-02-24 2017-06-13 上海微喂网络科技有限公司 Apply the full-time monitoring intelligent heartbeat method in real-time intercommunication network
CN106936668A (en) * 2017-05-08 2017-07-07 深圳市立昌机电设备有限公司 The instrument operating condition monitoring method and system of coil winding machine
WO2018205110A1 (en) * 2017-05-08 2018-11-15 深圳市立昌机电设备有限公司 Method and system for monitoring working state of winding machine
CN106972977A (en) * 2017-05-24 2017-07-21 北京潘达互娱科技有限公司 The long connection maintaining method of one kind and device
CN107249136A (en) * 2017-06-07 2017-10-13 北京潘达互娱科技有限公司 Method for connecting network and device
CN107819648A (en) * 2017-11-14 2018-03-20 新华三技术有限公司 Network configuration NETCONF connecting detection method and apparatus
CN107819648B (en) * 2017-11-14 2020-08-04 新华三技术有限公司 Method and device for detecting NETCONF connection of network configuration
CN113890894A (en) * 2021-10-19 2022-01-04 平安普惠企业管理有限公司 Keep-alive method and device for client communication link, electronic equipment and storage medium
CN113890894B (en) * 2021-10-19 2024-03-01 广东迅维信息产业股份有限公司 Client communication link keep-alive method and device, electronic equipment and storage medium
CN117336213A (en) * 2023-12-01 2024-01-02 四川才子软件信息网络有限公司 Subsystem monitoring method, system and equipment
CN117336213B (en) * 2023-12-01 2024-02-27 四川才子软件信息网络有限公司 Subsystem monitoring method, system and equipment

Similar Documents

Publication Publication Date Title
CN106411627A (en) Network connection detection method and apparatus
US20210022022A1 (en) Method and device for monitoring network data
CN109803278B (en) Non-connection state measuring method, terminal and base station
CN104936240B (en) A kind of method for switching network and terminal
US20210051086A1 (en) Network Access Method and Terminal
CN107634962B (en) The management method and Related product of network bandwidth
CN103139307B (en) A kind of Internet resources download the restoration methods and download system of interrupting
CN107465841B (en) Fault information reporting method and terminal
CN110650492A (en) Measurement method, terminal and network side equipment
CN106454968B (en) A kind of caller method and device based on CSFB
CN112469096B (en) Cell switching method and device
CN113891410A (en) IMS network registration method and device, terminal and readable storage medium
CN110677842B (en) Network searching method, device, terminal equipment and storage medium
CN111669799A (en) Network connection method and device and electronic equipment
CN105792301B (en) A kind of terminal of handover network, method and system
CN110446220A (en) A kind of wireless link recovery method and terminal
CN110324834A (en) Indicating means, terminal and the base station of measurement result
CN111093238B (en) Wireless network control method and device, storage medium and electronic equipment
CN112399515B (en) Communication processing method and device
CN113596947A (en) Network switching method and device and electronic equipment
CN105657701B (en) A kind of call method and device based on eSIM card
CN110351743A (en) A kind of measurement method, terminal and network side equipment
CN104468337B (en) Method for message transmission and device, message management central apparatus and data center
CN105120472A (en) Access point and access point management method and system
CN105704773B (en) A kind of method, mobile communication system and mobile terminal switching mobile telecommunication channel

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170215

RJ01 Rejection of invention patent application after publication