CN109040295B - Method and device for determining abnormal disconnection, terminal and storage medium - Google Patents

Method and device for determining abnormal disconnection, terminal and storage medium Download PDF

Info

Publication number
CN109040295B
CN109040295B CN201811000478.9A CN201811000478A CN109040295B CN 109040295 B CN109040295 B CN 109040295B CN 201811000478 A CN201811000478 A CN 201811000478A CN 109040295 B CN109040295 B CN 109040295B
Authority
CN
China
Prior art keywords
client
server
disconnection
state parameter
connection
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.)
Active
Application number
CN201811000478.9A
Other languages
Chinese (zh)
Other versions
CN109040295A (en
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.)
Vitrolight Technology Co ltd
Original Assignee
Vitrolight Technology 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 Vitrolight Technology Co ltd filed Critical Vitrolight Technology Co ltd
Priority to CN201811000478.9A priority Critical patent/CN109040295B/en
Publication of CN109040295A publication Critical patent/CN109040295A/en
Application granted granted Critical
Publication of CN109040295B publication Critical patent/CN109040295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • 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
    • H04L67/141Setup of application sessions
    • 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
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route

Abstract

The invention discloses a method and a device for determining abnormal disconnection, a terminal and a storage medium. The method comprises the following steps: when the disconnection between the client and the server is monitored, acquiring the current state parameters of the client and the original state parameters when the connection between the client and the server is established; and if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection. By adopting the technical scheme, the embodiment of the invention can improve the detection efficiency of the abnormal disconnection of the client, reduce the memory occupied by the abnormal disconnection detection and the consumed network flow, shorten the time consumed by reestablishing the connection between the client and the server, and improve the timeliness of the communication content between the client and the server.

Description

Method and device for determining abnormal disconnection, terminal and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for determining an abnormal disconnection, a terminal, and a storage medium.
Background
With the popularization of intelligent terminals and the increase of the commercial requirements of people on the intelligent terminals, communication connections established based on the WebSocket protocol (hereinafter referred to as WebSocket connections) are gradually applied more and more.
The WebSocket Protocol is a new network Protocol based on a Transmission Control Protocol (TCP), and it implements full duplex communication between the browser and the server, i.e. when the communication is performed based on the WebSocket Protocol, the server can actively transmit data to the client, which provides great convenience for remote management of the intelligent terminal. With the popularization of the WebSocket communication function in each client, people pay more and more attention to the abnormal disconnection monitoring method of the WebSocket connection. Currently, in the prior art, whether WebSocket communication between a client and a server is abnormally disconnected is monitored by sending a heartbeat packet to the server, that is, the client sends the heartbeat packet to the server, and if response information replied by the server based on the heartbeat packet is not received, the WebSocket communication between the client and the server is determined to be abnormally disconnected.
However, the method of monitoring through the heartbeat packet requires the client to send the heartbeat packet to the server at regular time, and the too high sending rate of the heartbeat packet can greatly consume the memory and network traffic of the client device, thereby affecting the operation and communication rate of the client device; the heartbeat packet rate is too slow, so that the disconnection detection between the client and the server is not timely enough, and the timeliness of the communication content between the client and the server is seriously influenced.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for determining an abnormal disconnection, a terminal, and a storage medium, so as to solve the technical problem that the existing abnormal disconnection detection method cannot consider both the operation rate of a client device and the timeliness of communication information between a client and a server.
In a first aspect, an embodiment of the present invention provides a method for determining an abnormal disconnection, including:
when the disconnection between the client and the server is monitored, acquiring the current state parameters of the client and the original state parameters when the connection between the client and the server is established;
and if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection.
In a second aspect, an embodiment of the present invention provides an apparatus for determining an abnormal disconnection, including:
the parameter acquisition module is used for acquiring the current state parameters of the client and the original state parameters when the client and the server are connected when the disconnection of the client and the server is monitored;
and the abnormal disconnection determining module is used for responding to the condition that the current state parameter is the same as the original state parameter and determining the disconnection as abnormal disconnection.
In a third aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
a memory for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining an abnormal disconnection according to the embodiment of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for determining an abnormal wire break according to the embodiment of the present invention.
In the technical scheme for determining the abnormal disconnection, when the disconnection between the client and the server is monitored, the current state parameter of the client and the original state parameter when the connection between the client and the server is established are obtained, and if the current state parameter is the same as the original state parameter, the disconnection is determined as the abnormal disconnection. By adopting the technical scheme, the embodiment of the invention determines whether the client is abnormally disconnected or not based on the state parameters of the client, can improve the detection efficiency of the abnormal disconnection of the client, reduce the memory occupied by the abnormal disconnection detection and the consumed network flow, shorten the time consumed by reestablishing the connection between the client and the server, and improve the timeliness of the communication content between the client and the server.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1 is a schematic flowchart of a method for determining an abnormal wire break according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for determining an abnormal disconnection according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of a preferred method for determining an abnormal wire break according to a third embodiment of the present invention;
fig. 4 is a block diagram of a device for determining an abnormal disconnection according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings.
Example one
The embodiment of the invention provides a method for determining abnormal disconnection. The method may be performed by a device for determining an abnormal disconnection, wherein the device may be implemented by software and/or hardware, and may be generally integrated in a terminal device, and typically may be integrated in a mobile terminal. Fig. 1 is a schematic flowchart of a method for determining an abnormal disconnection according to an embodiment of the present invention, as shown in fig. 1, the method includes:
s110, when it is monitored that the client is disconnected with the server, the current state parameters of the client and the original state parameters when the client is connected with the server are obtained.
Taking a client device for installing a client as a mobile terminal adopting an android system as an example, the client can establish a Service after the client device is started, and the Service monitors whether the connection between the client and the server is disconnected and executes subsequent operations. The connection established between the client and the server may be any wireless communication connection, such as a communication connection established based on a TCP or a User Datagram Protocol (UDP), and the connection is described as a communication connection established based on a WebSocket Protocol (hereinafter referred to as a WebSocket connection for short).
The method for monitoring whether the connection between the client and the server is disconnected or not by the Service can be selected according to the requirement. Specifically, after the client establishes connection with the server, the Service may detect whether a WebSocket object exists in the client according to a set period, and if not, determine that the client is disconnected from the server. At this time, correspondingly, the client can construct the WebSocket object after establishing connection with the server, and revoke the WebSocket object after disconnecting the connection with the server. Or the client can construct the WebSocket object after establishing connection with the server, revoke the WebSocket object after disconnecting the connection with the server, and send WebSocket object revoking information to Service to inform Service that the WebSocket object is revoked. At this time, the WebSocket may determine whether the client is disconnected from the server by detecting whether WebSocket object revocation information sent by the client is received.
The Service can also detect whether the content of the WebSocket object in the client is empty according to a set period after the client is connected with the server, and if so, the client is determined to be disconnected through the server. At this time, correspondingly, the client may assign a certain content to the WebSocket object after establishing connection with the server, and revoke the content of the assigned WebSocket object after disconnecting from the server. Or the client may assign a certain content to the WebSocket object after establishing connection with the server, revoke the assigned content of the WebSocket after disconnecting the connection with the server, and send a WebSocket content revocation notification to the Service to notify the Service that the content of the current WebSocket object is empty. At this time, the WebSocket may detect whether a WebSocket content revocation notification sent by the client is received, so as to determine whether the client and the server are disconnected.
It should be noted that, although the embodiment is described by taking an example that the Service in the android device monitors whether the client is disconnected from the server, it should be understood by those skilled in the art that the embodiment may also be applied to the terminal device installed with the windows or other systems, and when the embodiment is applied to the terminal device installed with the android system or other systems, the Service may also not be established, and the client or other monitoring programs in the client device directly monitor the client, which is not limited in the embodiment.
In this embodiment, the current state parameter and the original state parameter of the client may be obtained locally from the client, that is, from the client device in which the client is installed. The current state parameter of the client can be understood as the state parameter of the client at the current moment; the original state parameter of the client may be understood as a state parameter when the client establishes a connection with the server, that is, a state parameter of the client before the client disconnects with the server, where the state parameter may be a state parameter of the client after the client disconnects with the server last time, or may be an initial value of the state parameter of the client given when the client establishes the connection with the server this time, and the initial value may be set by a user or a developer.
And S120, if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection.
In this embodiment, when the client is disconnected from the server normally, that is, when the client is disconnected from the server based on a user's trigger operation, the client modifies the state parameter of the client or the server controls the client to modify the state parameter, and the modified state parameter of the client (that is, the state parameter of the client when the client is disconnected from the server is detected) becomes another parameter different from the original state parameter of the client, so that whether the disconnection between the client and the server is an abnormal disconnection can be determined based on whether the state parameter of the client is modified, that is, based on whether the current state parameter of the client is still the original state parameter.
In view of the simplicity of modifying the client state parameters, it is preferable that the client actively modifies its own state parameters when the client disconnects from the server based on user operation. At this time, the method for determining an abnormal disconnection provided in this embodiment may further include: and when detecting that the disconnection button of the client is triggered, modifying the state parameters of the client, and sending a disconnection request to the server to disconnect the server. The modified state parameter of the client may be any or preset other parameter different from the original state parameter of the client. For example, assuming that the original state parameter of the client is 0 (or true), the state parameter of the client may be modified to 1 (or false) when the client is normally disconnected from the server, or the state parameter of the client may be modified to other parameters besides 0, 1, true or false, which is not limited herein.
In the method for determining an abnormal disconnection provided in the embodiment of the present invention, when it is monitored that the client is disconnected from the server, a current state parameter of the client and an original state parameter of the client when the client is connected to the server are obtained, and if the current state parameter is the same as the original state parameter, the current disconnection is determined as the abnormal disconnection. By adopting the technical scheme, the embodiment of the invention determines whether the client is abnormally disconnected or not based on the state parameters of the client, can improve the detection efficiency of the abnormal disconnection of the client, reduce the memory occupied by the abnormal disconnection detection and the consumed network flow, shorten the time consumed by reestablishing the connection between the client and the server, and improve the timeliness of the communication content between the client and the server.
Example two
Fig. 2 is a schematic flow chart of a method for determining an abnormal disconnection according to a second embodiment of the present invention. The present embodiment is optimized on the basis of the foregoing embodiment, and further, after determining that the disconnection is an abnormal disconnection, the method further includes: sending a connection establishment request to a server, and receiving request response information returned by the server based on the connection establishment request so as to reestablish connection with the server.
Further, after the connection is reestablished with the server, the method further includes: setting the state parameter of the client to be a given original state parameter; or determining the state parameter of the client when the connection is established as the original state parameter of the client.
Correspondingly, as shown in fig. 2, the method for determining an abnormal disconnection provided in this embodiment includes:
s210, when it is monitored that the client is disconnected with the server, the current state parameters of the client and the original state parameters when the client is connected with the server are obtained.
And S220, if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection.
S230, sending a connection establishment request to a server, and receiving request response information returned by the server based on the connection establishment request so as to reestablish connection with the server.
In this embodiment, after determining that the client and the server are abnormally disconnected, the connection establishment request may be actively sent to the server, so that the client reestablishes a connection with the server. The connection establishment request may include an identity of the client, such as an IP address of the client device and/or an account of the client user. Correspondingly, after receiving the connection establishment request sent by the client, the server can return request response information to the client according to the identity in the connection establishment request. Therefore, the client can receive the request response information returned by the server to establish connection with the server; or, further, after receiving the request response information returned by the server, the client may send response confirmation information to the server again to prevent an erroneous connection from being generated.
In an implementation manner of this embodiment, after sending the connection establishment request to the server, if the request response information returned by the server is not received within a certain time, or if the request response information returned by the server is received but the client does not yet establish a connection with the server successfully, the server may send the connection establishment request to the server again after sleeping for a set time, such as 20s, 30s, or 1 minute, and so on, until the client establishes a connection with the server successfully. At this time, preferably, the method for determining an abnormal disconnection provided in this embodiment may further include: and if the request response information returned by the server based on the connection establishment request is not received within the first time span, sending the connection establishment request to the server again after a second time span until the request response information returned by the server based on the connection establishment request is received. The first time length and the second time length may be set as required, and are not limited herein.
S240, setting the state parameters of the client to be given original state parameters; or determining the state parameter of the client when the connection is established as the original state parameter of the client.
In this embodiment, an original state parameter of the client when the client and the server are in a connected state and a non-original state parameter of the client when the client is disconnected from the server based on a user operation may be preset; two or more state parameters can be set for the client, and each state parameter can be used as an original state parameter when the client is connected with the server or a non-original state parameter when the client is disconnected with the server based on user operation.
For example, for the situation that the original state parameter and the non-original state parameter of the client are given in advance, after it is monitored that the client establishes connection with the server, the state parameter of the client is set as the original state parameter, and when it is monitored that the client disconnects from the server based on a disconnection instruction generated by user triggering, the state parameter of the client is modified from the original state parameter to the given non-original state parameter. For example, after it is monitored that the client is connected to the server, the current state parameter of the client may be acquired and it is determined whether the state parameter is an original state parameter, if so (that is, if the last disconnection between the client and the server is a normal disconnection), the state parameter of the client may be modified to a given original state parameter, and if not (that is, if the last disconnection between the client and the server is an abnormal disconnection), the original state parameter may be retained.
For the condition that the original state parameters and the non-original state parameters are not fixed parameters, after the connection between the client and the server is monitored, the state parameters of the client when the connection between the client and the server is established are marked as the original state parameters of the client, and when the client is disconnected from the server based on a disconnection instruction generated by user triggering, the state parameters of the client are modified into any other state parameters different from the original state parameters.
In the method for determining abnormal disconnection provided in the second embodiment of the present invention, when the client is disconnected from the server, it is determined whether the current disconnection is abnormal disconnection based on the current state parameter and the original state parameter of the client, and if so, a connection establishment request is sent to the server to reestablish connection with the server, and the state parameter of the client is set as the given original state parameter or the state parameter of the client when the connection is established is determined as the original state parameter of the client. By adopting the technical scheme, the connection with the server can be timely reestablished, the time consumed by reestablishing the connection between the client and the server is shortened, and the timeliness of the communication content between the client and the server is improved.
EXAMPLE III
The third embodiment of the invention provides a preferable method for determining abnormal disconnection. The method may be performed by a device for determining an abnormal disconnection, wherein the device may be implemented by software and/or hardware, and may be generally integrated in a terminal device, and typically may be integrated in a mobile terminal. Fig. 3 is a schematic flow chart of a preferred method for determining an abnormal wire break provided in this embodiment, as shown in fig. 3, the method includes:
s310, synchronously starting the background Service connected with the WebSocket by the client device in the starting process.
The Service may be set corresponding to one or more clients in the client device, that is, a background Service may be set for each client installed in the client device, or a background Service may be set for a plurality of or all clients in the client device, which is not limited herein. In consideration of differences of WebSocket connections of different clients, background services corresponding to one-to-one may be preferably set for each client in the client device.
S320, the Service constructs a WebSocket object, sends a connection establishment request to the server so that the client establishes WebSocket connection with the server, and executes S330 or S340.
And the WebSocket objects correspond to the clients which are connected with the server one by one.
And S330, when the WebSocket connection is failed to be established, the Service sets the time length in a dormant mode, and returns to S320.
And S340, when the WebSocket connection is successfully established, the Service assigns initial values to the state parameters of the client, and executes S350 or S360.
Therefore, the client and the server are normally connected, information interaction can be normally performed between the client and the server, and for example, the server can send data requested by the client to the client based on a data request sent by the client, and can also actively push data information to the client.
And S350, when the client receives a disconnection instruction generated by user triggering, the Service modifies the state parameter of the client into a non-initial value, calls a disconnect () method to disconnect the client from the server, cancels the constructed WebSocket object, and executes S370.
And S360, when the client cannot detect the server, the Service calls a disconnect () method to disconnect the client from the server and revoke the constructed WebSocket object.
S370, when detecting that the WebSocket object is withdrawn, the Service calls an onclose () method to judge whether the current state parameter of the client is an initial value, if so, returning to S320; if not, go to S380.
S380, the Service monitors whether the client receives a connection establishing instruction generated by user triggering according to a set period, if so, S320 is executed; if not, go to S390.
And S390, when the client device receives a shutdown instruction generated by user triggering, executing shutdown operation and closing the background Service connected with the WebSocket.
According to the preferred method for determining the abnormal disconnection, whether the WebSocket connection between the client and the server is abnormally disconnected or not is determined through the state parameters of the client, and the WebSocket connection is reestablished with the server when the WebSocket connection is abnormally disconnected, so that the time consumed by reestablishing the connection between the client and the server can be shortened, the server can be ensured to push information to the client in time, and the use experience of a user is improved.
Example four
The fourth embodiment of the invention provides a device for determining abnormal disconnection. The apparatus may be implemented by software and/or hardware, may be generally integrated in a terminal device, and may be typically integrated in a mobile terminal, and may determine whether an abnormal disconnection occurs between a client and a server by performing a method for determining an abnormal disconnection. Fig. 4 is a block diagram of a structure of an abnormal disconnection determining apparatus according to a fourth embodiment of the present invention, as shown in fig. 4, the apparatus includes:
a parameter obtaining module 401, configured to obtain, when it is monitored that the client is disconnected from the server, a current state parameter of the client and an original state parameter of the client when the client establishes a connection with the server;
an abnormal disconnection determining module 402, configured to determine, in response to a situation that the current state parameter is the same as the original state parameter, that the disconnection is an abnormal disconnection.
In the method for determining abnormal disconnection provided in the fourth embodiment of the present invention, when it is monitored that the client is disconnected from the server, the current state parameter of the client and the original state parameter of the client when the client is connected to the server are obtained through the parameter obtaining module, and if the current state parameter is the same as the original state parameter, the current disconnection is determined as abnormal disconnection through the abnormal disconnection determining module. By adopting the technical scheme, whether the client is abnormally disconnected is determined based on the state parameters of the client, the detection efficiency of the abnormal disconnection of the client can be improved, the memory occupied by the abnormal disconnection detection and the consumed network flow are reduced, the time consumed by reestablishing the connection between the client and the server is shortened, and the timeliness of the communication content between the client and the server is improved.
On the basis of the above embodiment, the device for determining abnormal wire breakage may further include: and the disconnection module is used for modifying the state parameters of the client and sending a disconnection request to the server to disconnect the server when detecting that the disconnection button of the client is triggered.
On the basis of the above embodiment, the device for determining abnormal wire breakage may further include: and the first reconnection module is used for sending a connection establishment request to the server after the disconnection is determined as abnormal disconnection, and receiving request response information returned by the server based on the connection establishment request so as to reestablish connection with the server.
On the basis of the above embodiment, the device for determining abnormal wire breakage may further include: and the second reconnection module is used for responding to the condition that the request response information returned by the server based on the connection establishment request is not received within the first time span, and sending the connection establishment request to the server again after a second time span until the request response information returned by the server based on the connection establishment request is received.
On the basis of the above embodiment, the device for determining abnormal wire breakage may further include: and the parameter determining module is used for setting the state parameter of the client to be a given original state parameter after the connection with the server is reestablished, or determining the state parameter of the client when the connection is established to be the original state parameter of the client.
In the above scheme, the connection between the client and the server may be a WebSocket connection.
The device for determining abnormal disconnection provided by the fourth embodiment of the present invention can execute the method for determining abnormal disconnection provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the method for determining abnormal disconnection. For the technical details not described in detail in this embodiment, reference may be made to the method for determining an abnormal disconnection provided in any embodiment of the present invention.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention, as shown in fig. 5, the terminal includes a processor 50 and a memory 51, and may further include an input device 52 and an output device 53; the number of the processors 50 in the terminal may be one or more, and one processor 50 is taken as an example in fig. 5; the processor 50, the memory 51, the input device 52 and the output device 53 in the terminal may be connected by a bus or other means, which is exemplified in fig. 5.
The memory 51 is used as a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the abnormal wire break determination method in the embodiment of the present invention (for example, the parameter acquisition module 401 and the abnormal wire break determination module 402 in the abnormal wire break determination device). The processor 50 executes various functional applications and data processing of the terminal by running software programs, instructions, and modules stored in the memory 51, that is, implements the above-described method of determining an abnormal disconnection.
The memory 51 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 51 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 51 may further include memory located remotely from the processor 50, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 52 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal. The output device 53 may include a display device such as a display screen.
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a method for determining an abnormal disconnection, the method including:
when the disconnection between the client and the server is monitored, acquiring the current state parameters of the client and the original state parameters when the connection between the client and the server is established;
and if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the method for determining an abnormal disconnection provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the apparatus for determining an abnormal disconnection, each unit and each module included in the apparatus are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (8)

1. A method for determining an abnormal disconnection, comprising:
when the disconnection between the client and the server is monitored, acquiring the current state parameters of the client and the original state parameters when the connection between the client and the server is established;
if the current state parameter is the same as the original state parameter, determining the disconnection as abnormal disconnection;
after the disconnection is determined as abnormal disconnection, the method further comprises the following steps:
sending a connection establishment request to a server, and receiving request response information returned by the server based on the connection establishment request so as to reestablish connection with the server;
after the connection with the server is reestablished, the method further comprises the following steps:
setting the state parameter of the client to be a given original state parameter; alternatively, the first and second electrodes may be,
determining the state parameter of the client as the original state parameter of the client when the connection is established;
the setting of the state parameter of the client to the given original state parameter includes:
setting two or more state parameters for the client, wherein the state parameters are used as original state parameters when the client is connected with the server or used as non-original state parameters when the client is disconnected with the server based on user operation.
2. The method of claim 1, further comprising:
and when detecting that the disconnection button of the client is triggered, modifying the state parameters of the client, and sending a disconnection request to the server to disconnect the server.
3. The method of claim 1, further comprising:
and if the request response information returned by the server based on the connection establishment request is not received within the first time span, sending the connection establishment request to the server again after a second time span until the request response information returned by the server based on the connection establishment request is received.
4. A method according to any of claims 1-3, wherein the connection between the client and the server is a WebSocket connection.
5. An apparatus for determining an abnormal disconnection, comprising:
the parameter acquisition module is used for acquiring the current state parameters of the client and the original state parameters when the client and the server are connected when the disconnection of the client and the server is monitored;
an abnormal disconnection determining module, configured to determine, in response to a situation that the current state parameter is the same as the original state parameter, that the current disconnection is an abnormal disconnection;
the device for determining abnormal disconnection further comprises:
a parameter determining module, configured to set a state parameter of the client to a given original state parameter after reestablishing the connection with the server, or determine the state parameter of the client as the original state parameter of the client when establishing the connection;
the setting of the state parameter of the client to the given original state parameter includes:
setting two or more state parameters for the client, wherein the state parameters are used as original state parameters when the client is connected with the server or used as non-original state parameters when the client is disconnected with the server based on user operation.
6. The apparatus of claim 5, further comprising:
and the disconnection module is used for modifying the state parameters of the client and sending a disconnection request to the server to disconnect the server when detecting that the disconnection button of the client is triggered.
7. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of determining an abnormal disconnection of any of claims 1-4.
8. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method of determining an abnormal disconnection according to any one of claims 1 to 4.
CN201811000478.9A 2018-08-30 2018-08-30 Method and device for determining abnormal disconnection, terminal and storage medium Active CN109040295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811000478.9A CN109040295B (en) 2018-08-30 2018-08-30 Method and device for determining abnormal disconnection, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811000478.9A CN109040295B (en) 2018-08-30 2018-08-30 Method and device for determining abnormal disconnection, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109040295A CN109040295A (en) 2018-12-18
CN109040295B true CN109040295B (en) 2021-07-20

Family

ID=64626310

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811000478.9A Active CN109040295B (en) 2018-08-30 2018-08-30 Method and device for determining abnormal disconnection, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109040295B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112017082B (en) * 2020-07-28 2023-12-05 安徽鸿程光电有限公司 Data processing method, device, electronic equipment and storage medium
CN112565359B (en) * 2020-11-25 2023-05-30 上汽通用五菱汽车股份有限公司 Network connection method, system, vehicle-mounted terminal and storage medium
CN114915651B (en) * 2021-02-09 2023-09-26 武汉斗鱼网络科技有限公司 WebSocket management method and device, electronic equipment and storage medium
CN113013880A (en) * 2021-04-20 2021-06-22 西安兴汇电力科技有限公司 Fault processing method based on 5G communication module distribution line
CN114257632B (en) * 2021-12-21 2023-06-02 建信金融科技有限责任公司 Method and device for reconnecting broken wire, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298757A (en) * 2003-01-27 2011-12-28 松下电器产业株式会社 A terminal device, a server device, a digital content distribution system and an item processing method
CN103001822A (en) * 2012-08-29 2013-03-27 五八同城信息技术有限公司 Network anomaly handling method and device
CN106464395A (en) * 2015-03-01 2017-02-22 Lg电子株式会社 Broadcast signal transmitting device, broadcast signal receiving device, broadcast signal transmitting method, and broadcast signal receiving method
CN106612216A (en) * 2015-10-27 2017-05-03 北京国双科技有限公司 Method and apparatus of detecting website access exception

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6772773B2 (en) * 2016-11-14 2020-10-21 ブラザー工業株式会社 Communication device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298757A (en) * 2003-01-27 2011-12-28 松下电器产业株式会社 A terminal device, a server device, a digital content distribution system and an item processing method
CN103001822A (en) * 2012-08-29 2013-03-27 五八同城信息技术有限公司 Network anomaly handling method and device
CN106464395A (en) * 2015-03-01 2017-02-22 Lg电子株式会社 Broadcast signal transmitting device, broadcast signal receiving device, broadcast signal transmitting method, and broadcast signal receiving method
CN106612216A (en) * 2015-10-27 2017-05-03 北京国双科技有限公司 Method and apparatus of detecting website access exception

Also Published As

Publication number Publication date
CN109040295A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
CN109040295B (en) Method and device for determining abnormal disconnection, terminal and storage medium
CN107645529B (en) Heartbeat packet sending method and device
CN105916100B (en) Method, device and communication system for acting heartbeat packet
JP7234402B2 (en) Secondary link monitoring method for vehicle communication, vehicle communication terminal, electronic device and computer program
CN106598633B (en) Configuration file updating method, client and server
CN113709839A (en) Multi-gateway network switching method, device and system, electronic equipment and storage medium
TWI488455B (en) Method and system for a connection between devices and the devices thereof
US20210243136A1 (en) Method, device and system for resource allocation
CN111263338A (en) Network distribution method of Bluetooth Mesh network and related network distribution equipment and system
CN113490218A (en) Pairing method, pairing device, Bluetooth remote controller, intelligent device and storage medium
CN107508916B (en) Server link management method for intelligent robot
CN112860408A (en) Process keep-alive method, device and system in cloud reality machine and storage medium
CN110809262A (en) Internet of things equipment operation and maintenance management method based on COAP protocol
WO2020118633A1 (en) Subscription message processing method and apparatus, and computer device and storage medium
CN109245974A (en) Household electrical appliance distribution method, apparatus and computer readable storage medium
US20170127472A1 (en) Method and wireless device for controlling disconnection of a wireless device in a wi-fi direct group of a wireless network
CN109413180B (en) Data acquisition method, system and equipment and storage medium
CN114884805B (en) Data transmission method, device, terminal and storage medium
CN111162952A (en) Equipment fault tolerance method and device
CN107465751B (en) Communication method, device, client and computer storage medium
CN107872824B (en) Wireless service processing method, device, equipment and storage medium
CN106992878B (en) Multicast detection method and device
CN110830305A (en) Method and device for accessing wireless device to WIFI network, electronic device and storage medium
CN110581861A (en) outdoor networking method, acquisition server, acquisition system and storage medium
CN110912839B (en) Main and standby switch detection method, system, terminal and storage medium

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
CB03 Change of inventor or designer information

Inventor after: Zhang Xin

Inventor after: Zhang Yirong

Inventor after: Wu Jianbo

Inventor after: Gu Weimin

Inventor before: Zhang Xin

Inventor before: Zhang Yirong

Inventor before: Wu Jianbo

CB03 Change of inventor or designer information
GR01 Patent grant
GR01 Patent grant