CN112738187B - Safe connection method and device of equipment, electronic equipment and storage medium - Google Patents
Safe connection method and device of equipment, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112738187B CN112738187B CN202011553985.2A CN202011553985A CN112738187B CN 112738187 B CN112738187 B CN 112738187B CN 202011553985 A CN202011553985 A CN 202011553985A CN 112738187 B CN112738187 B CN 112738187B
- Authority
- CN
- China
- Prior art keywords
- platform
- connection
- port number
- server address
- connection request
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/143—Termination or inactivation of sessions, e.g. event-controlled end of session
- H04L67/145—Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Cardiology (AREA)
- General Health & Medical Sciences (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention provides a method and a device for safely connecting equipment, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a modification instruction sent by a first platform, wherein the modification instruction comprises a server address and a port number of a second platform; responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform; sending a first connection request to the second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform; and if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform under a second preset condition so as to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform. The invention can improve the stability of equipment connection.
Description
Technical Field
The present invention relates to the field of device connection technologies, and in particular, to a method and an apparatus for secure connection of devices, an electronic device, and a storage medium.
Background
With the increasing popularity of Internet Technology (IT), terminal devices need to interact with various platforms. When data required by terminal equipment are on different platforms, data interaction needs to be carried out by switching from one data platform to another platform, servers corresponding to different platforms are different, and addresses corresponding to the servers are different. When the terminal device wants to connect and communicate with the platform, the terminal device needs to know the server address of the platform to normally communicate. In some use environments, the server address of the platform needs to be modified, once the server address of the platform is modified incorrectly, the terminal device cannot be connected with a new platform and cannot be connected with an original platform, and therefore poor stability of device connection is caused.
Disclosure of Invention
The embodiment of the invention provides a safe connection method of equipment, which can solve the problem of poor connection stability of the existing equipment.
In a first aspect, an embodiment of the present invention provides a method for securely connecting devices, where the method includes:
receiving a modification instruction sent by a first platform, wherein the modification instruction comprises a server address and a port number of a second platform;
responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform;
sending a first connection request to the second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform;
and if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform under a second preset condition so as to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform.
Preferably, after the step of determining whether the response message of the second platform is received under the first preset condition, the method further includes:
and if the response information of the second platform is received under the first preset condition, connecting and communicating with the second platform according to the server address and the port number of the second platform.
Preferably, after the step of receiving the modification instruction sent by the first platform, the method further includes the steps of:
and saving the server address and the port number of the second platform.
Preferably, the first preset condition includes a first preset time range, and the step of sending the first connection request to the second platform according to the server address and the port number of the second platform and determining whether the response message of the second platform is received under the first preset condition includes the following steps:
after a first connection request is sent to the second platform, real-time first connection time begins to be calculated;
judging whether response information of the second platform is received within a first preset time range or not according to the first connection time;
if the response information of the second platform is not received in the first preset time range, judging whether the first connection time exceeds a specified time length;
if the first connection time does not exceed the specified time length, continuing to send a first connection request to the second platform;
and if the first connection time exceeds the specified time, executing the connection request between the first platform and the second platform, and sending a second connection request to the first platform to reestablish connection with the first platform.
Preferably, if the response message of the second platform is received under the first preset condition, the step of performing connection communication with the second platform according to the server address and the port number of the second platform includes:
and if the response information of the second platform is received within the first preset time range, connecting and communicating with the second platform according to the server address and the port number of the second platform.
Preferably, the second preset condition includes a second preset time range, and the step of sending the second connection request to the first platform under the second preset condition to reestablish the connection with the first platform includes:
after sending a second connection request to the first platform, starting to calculate real-time second connection time;
judging whether response information of the first platform is received under a second preset condition or not according to the second connection time;
and if the response information of the first platform is not received within the second preset time range, continuing to send a second connection request to the second platform until the reconnection with the first platform is successful.
In a second aspect, an embodiment of the present invention further provides a device for securely connecting equipment, where the device includes:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a modification instruction sent by a first platform, and the modification instruction comprises a server address and a port number of a second platform;
the response module is used for responding to the first platform according to the modification instruction and disconnecting the communication connection with the first platform;
a sending module, configured to send a first connection request to the second platform according to the server address and the port number of the second platform, and determine whether to receive response information of the second platform under a first preset condition, where the first connection request carries the server address and the port number of the second platform;
and the reestablishment module is configured to cancel the connection request with the second platform if the response information of the second platform is not received under the first preset condition, and send a second connection request to the first platform under a second preset condition so as to reestablish connection with the first platform, where the second connection request carries the server address and the port number of the first platform.
Preferably, after the sending module, the apparatus further comprises:
and the connection module is used for connecting and communicating with the second platform according to the server address and the port number of the second platform if the response message of the second platform is received under the first preset condition.
In a third aspect, an embodiment of the present invention further provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps in the secure connection method of the device provided in the above embodiments when executing the computer program.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements the steps in the secure connection method for the device provided in the foregoing embodiment.
In the embodiment of the invention, a modification instruction sent by a first platform is received, wherein the modification instruction comprises a server address and a port number of a second platform; responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform; sending a first connection request to a second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform; and if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform. Therefore, when the server address and the port number configuration of the second platform are wrong, the terminal equipment can be automatically connected to the first platform and receive a new server address and port number configuration. And further, the terminal equipment can be ensured to be connected and communicated with one of the first platform or the second platform, and the access requirement of the terminal equipment is met. And then improve the stability that equipment is connected.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is an architectural diagram of a secure connection system for a device provided by an embodiment of the present invention;
fig. 2 is a timing chart of data interaction according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for secure connection of devices according to an embodiment of the present invention;
fig. 4 is a flowchart of a secure connection method for another device according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a safety connection device of an apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a safety connection device of another apparatus provided in an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to explain the technical solution of the present invention more clearly, as shown in fig. 1, fig. 1 is an architecture diagram of a secure connection system of a device according to an embodiment of the present invention, where the secure connection system 100 of the device includes: terminal equipment 101, first platform 102, second platform 103. The terminal device 101 may communicate with the first platform 102 and the second platform 103 through an internet connection. The internet connection may be a wired network or a wireless network. The Wireless connection may be a WiFi (Wireless-Fidelity) connection, a bluetooth connection, a wimax (worldwide Interoperability for Microwave access) connection, a Zigbee connection, a uwb (ultra wideband) connection, or other Wireless connection means now known or developed in the future.
The first platform 102 and the second platform 103 are each provided with their own server, and each server is configured with its own server address and port number.
The first platform 102 may be referred to as an old platform, or may be a platform to which the terminal device 101 is successfully connected and communicates with. The second platform 103 may be referred to as a new platform, compared to the first platform 102, that is, the terminal device needs to connect to communicate with the old platform and also needs to connect to communicate with another new platform. The second platform 103 may be any one of other new platforms except the old platform. Of course, each new platform has its own server address and port number.
Each platform may be configured to perform data interaction with the terminal device 101 and collect terminal device 101 data. And each platform can remotely modify the server address and the port number of the terminal device 101, thereby facilitating the connection and communication between the terminal device 101 and other platforms.
The terminal device 101 is used for controlling or collecting data and performing data interaction with the first platform 102 or the second platform 103. When the terminal device 101 is connected to each platform, it is necessary to configure a service address and a port number of a server corresponding to each platform, and support remote server address and port number configuration.
It should be understood that the number of terminal devices 101, first platforms 102, and second platforms 103 in fig. 1 is merely illustrative. There may be any number of terminal devices 101, first platforms 102, second platforms 103, as desired for implementation.
As shown in fig. 2, fig. 2 is a timing chart of data interaction according to an embodiment of the present invention. When the terminal device 101 connects to the second platform 103 through the server address and the port number of the second platform 103 provided by the first platform 102, if the server address and the port number of the second platform 103 provided by the first platform 102 are wrong and the connection with the second platform 103 is not successful, the terminal device 101 can establish a connection with the first platform again. The first platform 102 may repeat the steps of modifying the server address and port number of the second platform 103 and performing a connection with the second platform 103. When the terminal device 101 can successfully connect with the second platform 103, data interaction can be directly performed with the second platform 103. Thereby ensuring the stability of the connection of the terminal device 101.
Referring to fig. 3, fig. 3 is a flowchart of a secure connection method for a device according to an embodiment of the present invention, and as shown in fig. 3, the secure connection method for the device includes the following steps:
Wherein the modification instruction comprises a server address and a port number of the second platform. The server address may be an IP address of the server.
And the server address and the port number of the second platform are used for connection communication between the second platform and the terminal equipment.
And the terminal equipment is used for controlling or acquiring data and carrying out data interaction with the platform. The terminal device and the platform can adopt an internet connection mode, so that information such as a server address, a port number and the like needs to be configured, and remote server address and port number configuration is supported.
When the server address and the port number configured by the terminal device are different, the connected platforms are different. Each platform is correspondingly provided with a server address and a port number which belong to the platform, and the server address and the port number are used for distinguishing servers of other platforms. The servers of each platform may provide the same data services that the data services industry may provide. When the terminal equipment needs to be connected and communicated with other platforms, the terminal equipment can be connected and communicated with the platforms only by configuring the corresponding server addresses and port numbers.
And the platform is used for interacting with the terminal equipment and collecting the data of the terminal equipment, and the platform can remotely modify the server address and the port data of the terminal equipment. Both the first platform and the second platform can implement this function.
Specifically, the modification command may be sent autonomously by the first platform. For example, when the terminal device sends the a data request to the first platform but the first platform does not provide the a data service, the first platform may recommend the second platform capable of providing the a data service to the terminal device. At this time, the first platform sends a modification instruction to the terminal device to provide the terminal device with the server address and the port number of the second platform, so that the terminal device can be connected with the second platform for communication to obtain the data A.
In an embodiment of the present invention, after step 201, the method further comprises the steps of: the server address and port number of the second platform are saved.
Specifically, after the modification instruction is received, the server address and the port number of the second platform provided in the modification instruction may be saved, so as to facilitate connection with the second platform.
It should be noted that, while the server address and the port number of the second platform are saved, the server address and the port number of the first platform may also be saved, so that the terminal device and the first platform can be connected again.
And 202, responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform.
Specifically, after receiving the modification instruction sent by the first platform, the terminal device needs to reply that the first platform has received the modification instruction, and can directly disconnect the connection communication between the terminal device and the first platform, so as to connect with the second platform.
The first connection request carries the server address and the port number of the second platform. Of course, the first connection request may also include the type of data requested by the terminal device, the content of the data, and the like.
The first preset condition includes a first preset time range, and is a condition for judging whether the terminal device continues to send a connection request with the second platform. The first preset time range may be set according to actual needs, for example, the first preset time range may be set to 10 seconds, 20 seconds, 30 seconds, 1 minute, or other time ranges. The first preset condition may further include a first preset request frequency, and the first preset request frequency may also be set according to an actual requirement, for example, the first preset request frequency may be set to 5 times, 10 times, 20 times, and the like, and may also be set to a frequency of another value.
The response message is used for replying whether the terminal device receives the first connection request message.
Specifically, step 203 includes the steps of: and after the first connection request is sent to the second platform, calculating real-time first connection time. And judging whether response information of the second platform is received within a first preset time range or not according to the first connection time. And if the response information of the second platform is not received in the first preset time range, judging whether the first connection time exceeds the specified time length. And if the first connection time does not exceed the specified time length, continuously sending the first connection request to the second platform. If the first connection time exceeds the specified duration, step 204 is executed.
More specifically, after sending the first connection request to the second platform, the connection timing is started, and the response information of the second platform is monitored in real time within a first preset time range, so as to determine whether the response information of the second platform is received within the first preset time range. If the response message of the second platform is not received within the first preset time range, time length judgment needs to be carried out once to judge whether the first connection time exceeds the specified time length. If the first connection time is still within the specified time range, the first connection request can be continuously sent to the second platform, and the connection step is executed in a circulating mode. And stopping the connection with the second platform and returning to establish the connection with the first platform until the first connection time exceeds the specified time and no response information of the second platform is received.
It should be noted that the specified duration may be set according to actual needs, and the time range of the specified duration may be the same as the first preset time range, or may be greater than the first preset time range.
Of course, when the first preset condition includes a first preset number of requests, step 203 includes the steps of:
and after sending the first connection request to the second platform, starting to calculate the real-time first connection times. And judging whether response information of the second platform is received within the first preset request times or not according to the first connection times. And if the response information of the second platform is not received within the first preset request frequency, judging whether the first connection frequency exceeds the specified request frequency. And if the first connection times do not exceed the specified request times, continuously sending the first connection request to the second platform. If the first connection times exceed the specified request times, step 204 is executed.
It should be noted that the number of the specified requests may be set according to actual needs, and the number of the specified requests may be the same as the first preset number of requests, or may be greater than the first preset number of requests.
And 204, if the response message of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform under the second preset condition so as to reestablish the connection with the first platform.
And the second connection request carries the server address and the port number of the first platform. And the server address and the port number of the first platform are used for connection communication between the first platform and the terminal equipment.
Specifically, when the second preset condition includes a second preset time range, step 204 includes: and after sending the second connection request to the first platform, starting to calculate the real-time second connection time. And judging whether the response information of the first platform is received within a second preset time range or not according to the second connection time, and if the response information of the first platform is not received within the second preset time range, continuously sending a second connection request to the first platform until the reconnection with the first platform is successful.
More specifically, after sending the second connection request to the first platform, the connection timing is started, and the response information of the first platform is monitored in real time within a second preset time range, so as to determine whether the response information of the first platform is received within the second preset time range. And if the response information of the first platform is not received within the second preset time range, continuing to circularly execute the connection step until the reconnection with the first platform is successful.
Of course, the duration determination may also be performed once to determine whether the second connection time exceeds the preset duration. If the second connection time is still within the preset time range, the second connection request can be continuously sent to the first platform, and the connection step is executed in a circulating mode. And stopping the connection of the first platform and returning to the connection with the second platform again until the first connection time exceeds the specified time and the response information of the first platform is not received. Therefore, the terminal equipment can be connected with the first platform and the second platform, and the terminal equipment can be connected with and communicate with at least one of the first platform and the second platform.
After the terminal device reestablishes the connection communication with the first platform, the server address and the port number of the second platform may be confirmed with the first platform again, and then the connection step with the second platform may be executed again. Or, a server address and a port number of another second platform need to be requested from the first platform, and a connection step needs to be performed with another new platform, so as to meet the access requirement of the terminal device.
It should be noted that, when the terminal device does not receive the response message of the second platform, it may be that a server address or a port number of the second platform is configured incorrectly, and therefore, after reconnecting with the first platform, the server address and the port number of the second platform may be confirmed again, so as to reconnect with the second platform. Or the first platform modifies the server address and the port number of the other platform so as to meet the request requirement of the terminal equipment.
More specifically, when the second preset condition includes a second preset number of requests, step 204 includes: and after sending the second connection request to the first platform, starting to calculate the real-time second connection times. And judging whether the response information of the first platform is received within the second preset request times or not according to the second connection times, if the response information of the first platform is not received within the second preset request times, continuously sending a second connection request to the first platform until the reconnection with the first platform is successful.
In the embodiment of the invention, a modification instruction sent by a first platform is received, wherein the modification instruction comprises a server address and a port number of a second platform; responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform; sending a first connection request to the second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform; and if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform. Therefore, when the server address and the port number configuration of the second platform (new platform) are wrong, the terminal equipment can be automatically connected to the first platform (original platform) and receive the new server address and the port number configuration. And then, the terminal equipment can be ensured to be connected and communicated with one of the first platform or the second platform, and the access requirement of the terminal equipment is met. And then improve the stability that equipment is connected, still provide the security that equipment is connected simultaneously.
Referring to fig. 4, fig. 4 is a flowchart of another method for securely connecting devices according to an embodiment of the present invention. In another embodiment of the present invention, after step 203, the method for securely connecting the device further comprises the steps of:
Specifically, when the first preset condition includes a first preset time range, if the response message of the second platform is received under the first preset condition, the step of performing connection communication with the second platform according to the server address and the port number of the second platform may be: and if the response information of the second platform is received within the first preset time range, connecting and communicating with the second platform according to the server address and the port number of the second platform.
Of course, the first preset condition may include: when the number of the first preset requests is greater than the number of the first preset requests, if the response message of the second platform is received under the first preset condition, the step of connecting the second platform with the server address and the port number of the second platform may be: and if the response information of the second platform is received within the first preset request times, the second platform is communicated with the server address and the port number of the second platform in a connecting mode. For example, the first preset number of requests is set to 10, and when the 5 th time sends the first connection request to the second platform, the response message of the second platform is received, which indicates that the terminal device is directly connected to the second platform successfully and can perform communication.
In the embodiment of the invention, the server address and the port number of the second platform provided by the first platform can be used for connection communication with the second platform, so that data interaction between the terminal equipment and the second platform is realized, and the access requirement of the terminal equipment is met.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a safety connection device of an apparatus according to an embodiment of the present invention, where the safety connection device 400 of the apparatus includes:
a receiving module 401, configured to receive a modification instruction sent by a first platform, where the modification instruction includes a server address and a port number of a second platform;
a response module 402, configured to respond to the first platform according to the modification instruction, and disconnect a communication connection with the first platform;
a sending module 403, configured to send a first connection request to the second platform according to the server address and the port number of the second platform, and determine whether to receive response information of the second platform under a first preset condition, where the first connection request carries the server address and the port number of the second platform;
a reestablishment module 404, configured to cancel, if the response message of the second platform is not received under the first preset condition, the connection request with the second platform, and send, under the second preset condition, a second connection request to the first platform to reestablish the connection with the first platform, where the second connection request carries the server address and the port number of the first platform.
Preferably, as shown in fig. 6, after the module is transmitted, the secure connection apparatus 400 of the device further includes:
a connection module 405, configured to, if the response message of the second platform is received under the first preset condition, connect and communicate with the second platform according to the server address and the port number of the second platform.
Preferably, after receiving the module, the secure connection apparatus 400 of the device further includes:
and the storage module is used for storing the server address and the port number of the second platform.
Preferably, the first preset condition includes a first preset time range, and the sending module 403 includes:
the first sending unit is used for starting to calculate real-time first connection time after sending the first connection request to the second platform;
the first judging unit is used for judging whether response information of the second platform is received within a first preset time range or not according to the first connection time;
the second judging unit is used for judging whether the first connection time exceeds the specified time length or not if the response information of the second platform is not received in the first preset time range;
the second sending unit is used for continuing to send the first connection request to the second platform if the first connection time does not exceed the specified time length;
and the return execution unit is used for canceling the connection request with the second platform and sending a second connection request to the first platform to reestablish the connection with the first platform if the first connection time exceeds the specified time length.
Preferably, the connection module 405 is further configured to, if the response message of the second platform is received within the first preset time range, connect and communicate with the second platform according to the server address and the port number of the second platform.
Preferably, the second preset condition includes a second preset time range, and the reconstruction module 404 includes:
the computing unit is used for starting to compute real-time second connection time after sending a second connection request to the first platform;
the third judging unit is used for judging whether the response information of the first platform is received in a second preset time range or not according to the second connection time;
and the reestablishing unit is used for continuously sending the second connection request to the first platform until the reconnection with the first platform is successful if the response information of the first platform is not received within the second preset time range.
The secure connection apparatus 400 of the device according to the embodiment of the present invention can implement each implementation manner in the foregoing method embodiments, and corresponding beneficial effects, and for avoiding repetition, details are not described here again.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 500 includes: the memory 502, the processor 501 and a computer program stored on the memory 502 and executable on the processor 501, the processor 501 implements the steps in the secure connection method of the device provided by the above embodiments when executing the computer program, and the processor 501 executes the following steps:
receiving a modification instruction sent by a first platform, wherein the modification instruction comprises a server address and a port number of a second platform;
responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform;
sending a first connection request to the second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform;
and if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform under the second preset condition so as to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform.
Preferably, after the step of determining whether the response message of the second platform is received under the first preset condition, the processor 501 further performs the steps of:
and if the response information of the second platform is received under the first preset condition, connecting and communicating with the second platform according to the server address and the port number of the second platform.
Preferably, after the step of receiving the modification instruction sent by the first platform, which is executed by the processor 501, the processor 501 further executes the steps of:
the server address and port number of the second platform are saved.
Preferably, the first preset condition includes a first preset time range, and the step, executed by the processor 501, of sending the first connection request to the second platform according to the server address and the port number of the second platform, and under the first preset condition, determining whether the response message of the second platform is received includes the following steps:
after a first connection request is sent to a second platform, real-time first connection time begins to be calculated;
judging whether response information of the second platform is received within a first preset time range or not according to the first connection time;
if the response information of the second platform is not received within the first preset time range, judging whether the first connection time exceeds a specified time length;
if the first connection time does not exceed the specified duration, continuing to send a first connection request to the second platform;
and if the first connection time exceeds the specified time, executing the steps of canceling the connection request with the second platform, and sending a second connection request to the first platform so as to reestablish the connection with the first platform.
Preferably, the step, executed by the processor 501, of, if receiving the response message of the second platform under the first preset condition, performing connection communication with the second platform according to the server address and the port number of the second platform includes:
and if the response information of the second platform is received within the first preset time range, connecting and communicating with the second platform according to the server address and the port number of the second platform.
Preferably, the second preset condition includes a second preset time range, and the step executed by the processor 501, of sending the second connection request to the first platform under the second preset condition to reestablish the connection with the first platform, includes:
after a second connection request is sent to the first platform, real-time second connection time begins to be calculated;
judging whether response information of the first platform is received within a second preset time range or not according to the second connection time;
and if the response information of the first platform is not received within the second preset time range, continuing to send a second connection request to the second platform until the first platform is reconnected successfully.
The electronic device 500 provided in the embodiment of the present invention can implement each implementation manner in the foregoing method embodiments and corresponding beneficial effects, and for avoiding repetition, details are not described here again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the method for secure connection of devices provided in the embodiment of the present invention, and can achieve the same technical effect, and in order to avoid repetition, the computer program is not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, and the program can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.
Claims (9)
1. A method for secure connection of a device, the method comprising the steps of:
receiving a modification instruction sent by a first platform, wherein the modification instruction comprises a server address and a port number of a second platform;
responding to the first platform according to the modification instruction, and disconnecting the communication connection with the first platform;
sending a first connection request to the second platform according to the server address and the port number of the second platform, and judging whether response information of the second platform is received under a first preset condition, wherein the first connection request carries the server address and the port number of the second platform;
if the response information of the second platform is received under the first preset condition, the second platform is communicated with the server address and the port number of the second platform in a connecting mode;
if the response information of the second platform is not received under the first preset condition, canceling the connection request with the second platform, and sending a second connection request to the first platform under a second preset condition so as to reestablish connection with the first platform, wherein the second connection request carries the server address and the port number of the first platform;
wherein the first platform may repeatedly modify the server address and the port number of the second platform and perform the step of connecting with the second platform.
2. The method for secure connection of devices according to claim 1, wherein after said step of receiving a modification instruction sent by the first platform, the method further comprises the steps of:
and saving the server address and the port number of the second platform.
3. The method for secure connection of devices according to claim 1, wherein the first preset condition includes a first preset time range, and the step of sending the first connection request to the second platform according to the server address and the port number of the second platform and determining whether the response message of the second platform is received under the first preset condition includes the steps of:
after sending a first connection request to the second platform, starting to calculate real-time first connection time;
judging whether response information of the second platform is received within a first preset time range or not according to the first connection time;
if the response information of the second platform is not received in the first preset time range, judging whether the first connection time exceeds a specified time length;
if the first connection time does not exceed the specified time length, continuing to send a first connection request to the second platform;
and if the first connection time exceeds the specified time, executing the connection request between the first platform and the second platform, and sending a second connection request to the first platform to reestablish connection with the first platform.
4. The method for securely connecting devices according to claim 3, wherein if the response message of the second platform is received under the first preset condition, the step of communicating with the second platform according to the server address and the port number of the second platform comprises:
and if the response information of the second platform is received in the first preset time range, connecting and communicating with the second platform according to the server address and the port number of the second platform.
5. The method for secure connection of devices according to claim 1, wherein the second preset condition comprises a second preset time range, and the step of sending a second connection request to the first platform under the second preset condition to reestablish connection with the first platform comprises:
after sending a second connection request to the first platform, starting to calculate real-time second connection time;
judging whether response information of the first platform is received within a second preset time range or not according to the second connection time;
and if the response information of the first platform is not received within the second preset time range, continuing to send a second connection request to the second platform until the reconnection with the first platform is successful.
6. A secure connection of a device, the device comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a modification instruction sent by a first platform, and the modification instruction comprises a server address and a port number of a second platform;
the response module is used for responding to the first platform according to the modification instruction and disconnecting the communication connection with the first platform;
a sending module, configured to send a first connection request to the second platform according to the server address and the port number of the second platform, and determine whether to receive response information of the second platform under a first preset condition, where the first connection request carries the server address and the port number of the second platform;
and the reestablishment module is configured to cancel the connection request with the second platform if the response information of the second platform is not received under the first preset condition, and send a second connection request to the first platform under a second preset condition so as to reestablish connection with the first platform, where the second connection request carries the server address and the port number of the first platform.
7. The apparatus for secure connection of devices of claim 6, wherein after the sending module, the apparatus further comprises:
and the connection module is used for connecting and communicating with the second platform according to the server address and the port number of the second platform if the response message of the second platform is received under the first preset condition.
8. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, the processor implementing the steps in the method for secure connection of a device according to any of claims 1 to 5 when executing the computer program.
9. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps in the method for secure connection of a device according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011553985.2A CN112738187B (en) | 2020-12-24 | 2020-12-24 | Safe connection method and device of equipment, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011553985.2A CN112738187B (en) | 2020-12-24 | 2020-12-24 | Safe connection method and device of equipment, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112738187A CN112738187A (en) | 2021-04-30 |
CN112738187B true CN112738187B (en) | 2022-07-05 |
Family
ID=75615454
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011553985.2A Active CN112738187B (en) | 2020-12-24 | 2020-12-24 | Safe connection method and device of equipment, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112738187B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015184799A1 (en) * | 2014-06-05 | 2015-12-10 | 胡汉强 | Network access method, network device and management server |
CN106792934A (en) * | 2015-11-25 | 2017-05-31 | 大唐移动通信设备有限公司 | A kind of changing method and device |
CN107155202A (en) * | 2017-04-06 | 2017-09-12 | 深圳市金立通信设备有限公司 | A kind of method and terminal of control network switching |
CN107801222A (en) * | 2016-09-06 | 2018-03-13 | 中兴通讯股份有限公司 | Bluetooth and WiFi switching method and system, client and wireless access point equipment |
CN108306763A (en) * | 2018-01-05 | 2018-07-20 | 广东美的暖通设备有限公司 | Household appliance and its network connection processing method, computer readable storage medium |
CN110049010A (en) * | 2019-03-12 | 2019-07-23 | 广州市保伦电子有限公司 | A kind of method and system of distributed platform terminal device connection server |
WO2019242007A1 (en) * | 2018-06-22 | 2019-12-26 | 深圳前海达闼云端智能科技有限公司 | Device configuration method and apparatus, client terminal device, and cloud server |
CN111526544A (en) * | 2019-02-01 | 2020-08-11 | 北京三星通信技术研究有限公司 | Connection reestablishment method, context acquisition method, context management method, connection reestablishment method, node, and medium |
CN111741510A (en) * | 2020-05-25 | 2020-10-02 | 杭州涂鸦信息技术有限公司 | Method for automatically updating networking information, intelligent equipment and router |
-
2020
- 2020-12-24 CN CN202011553985.2A patent/CN112738187B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015184799A1 (en) * | 2014-06-05 | 2015-12-10 | 胡汉强 | Network access method, network device and management server |
CN106792934A (en) * | 2015-11-25 | 2017-05-31 | 大唐移动通信设备有限公司 | A kind of changing method and device |
CN107801222A (en) * | 2016-09-06 | 2018-03-13 | 中兴通讯股份有限公司 | Bluetooth and WiFi switching method and system, client and wireless access point equipment |
CN107155202A (en) * | 2017-04-06 | 2017-09-12 | 深圳市金立通信设备有限公司 | A kind of method and terminal of control network switching |
CN108306763A (en) * | 2018-01-05 | 2018-07-20 | 广东美的暖通设备有限公司 | Household appliance and its network connection processing method, computer readable storage medium |
WO2019242007A1 (en) * | 2018-06-22 | 2019-12-26 | 深圳前海达闼云端智能科技有限公司 | Device configuration method and apparatus, client terminal device, and cloud server |
CN111526544A (en) * | 2019-02-01 | 2020-08-11 | 北京三星通信技术研究有限公司 | Connection reestablishment method, context acquisition method, context management method, connection reestablishment method, node, and medium |
CN110049010A (en) * | 2019-03-12 | 2019-07-23 | 广州市保伦电子有限公司 | A kind of method and system of distributed platform terminal device connection server |
CN111741510A (en) * | 2020-05-25 | 2020-10-02 | 杭州涂鸦信息技术有限公司 | Method for automatically updating networking information, intelligent equipment and router |
Non-Patent Citations (3)
Title |
---|
"Route Optimization in Mobile Networks with Cache Assistance (RoMoNeCA)";Sahibzada Ahmed Noor;《中国硕士学位论文全文数据库信息科技辑》;20080315;全文 * |
"配置连接服务器";河北;《网络安全和信息化》;20161231;全文 * |
一种动态切换TCP连接IP地址的实现方法;温泽辉;《科技信息》;20110425(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112738187A (en) | 2021-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111356149A (en) | Wireless network configuration method and device | |
WO2019071829A1 (en) | Method, storage medium, device and system for implementing microphone connection-based battle between hosts on pc | |
CN105516640B (en) | A kind of detection method and system of video communication session exception | |
US10492245B2 (en) | Call termination method, application processor, and modem | |
CN103685398B (en) | Communication connection method for building up and communication system | |
CN105898786A (en) | Access point escape method and access point escape system | |
CN105636030B (en) | Share the method and device of access point | |
JPH10112740A (en) | Information processor, communication method and storage medium | |
CN112738187B (en) | Safe connection method and device of equipment, electronic equipment and storage medium | |
US20210006607A1 (en) | Communications apparatus, systems, and methods for preventing and/or minimizing session data clipping | |
CN107888693B (en) | NB-IOT device debugging method and server | |
CN110933775A (en) | Method and device for establishing signal connection and electronic equipment | |
CN107566418B (en) | Security management method and access device | |
CN104488300B (en) | Device management method and device, system | |
CN113691591B (en) | Data transmission method, device and computer readable storage medium | |
CN105721231A (en) | Service quality sensing detection method and service quality sensing detection device | |
CN113162922B (en) | Client data acquisition method and device, storage medium and electronic equipment | |
CN113746909A (en) | Network connection method, device, electronic equipment and computer readable storage medium | |
US20170116063A1 (en) | Communications state estimation device, communications state estimation method, and storage medium that stores communications state estimation program | |
CN115580555B (en) | Distributed task cancellation method, device, system and electronic equipment | |
WO2019237628A1 (en) | Rcu disconnection determination method and system, apparatus, and computer storage medium | |
CN105045759B (en) | Control communication method of financial self-service equipment | |
CN109451266B (en) | Remote control method and device | |
CN109413037A (en) | A kind of Modbus method for processing business and device | |
CN105992177B (en) | Method, device and system for improving usability of mobile proxy server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |