CN110417789B - Server connection method, electronic device, system and medium - Google Patents

Server connection method, electronic device, system and medium Download PDF

Info

Publication number
CN110417789B
CN110417789B CN201910708646.8A CN201910708646A CN110417789B CN 110417789 B CN110417789 B CN 110417789B CN 201910708646 A CN201910708646 A CN 201910708646A CN 110417789 B CN110417789 B CN 110417789B
Authority
CN
China
Prior art keywords
address
server
target
hardware
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
CN201910708646.8A
Other languages
Chinese (zh)
Other versions
CN110417789A (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.)
Shenzhen Onething Technology Co Ltd
Original Assignee
Shenzhen Onething 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 Shenzhen Onething Technology Co Ltd filed Critical Shenzhen Onething Technology Co Ltd
Priority to CN201910708646.8A priority Critical patent/CN110417789B/en
Publication of CN110417789A publication Critical patent/CN110417789A/en
Application granted granted Critical
Publication of CN110417789B publication Critical patent/CN110417789B/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
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • 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

Abstract

The invention provides a server connection method, electronic equipment, a system and a medium, wherein the method comprises the following steps: determining each hardware device to be connected when a server connection instruction is received; respectively carrying out random time delay on the connection operation of each hardware device; for each hardware device, when the hardware device is detected to delay, analyzing a first IP address of the authentication server; when the analysis fails, randomly acquiring a second IP address from the preset operator IP address; when available, randomly acquiring a target protocol from preset protocols; requesting the authentication server to assign a third IP address of a target server; when the third IP address is obtained, randomly obtaining a target port from a preset port list; and controlling the hardware equipment to be connected with the target server through the target port and the third IP address, solving the problem of connection between the hardware equipment and the server in a complex network environment and improving the success rate of connection between the hardware equipment and the server.

Description

Server connection method, electronic device, system and medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a server connection method, an electronic device, a system, and a medium.
Background
At present, more and more users use intelligent hardware devices such as guest cloud playing as private cloud disk products in order to realize high-quality digital entertainment life, and the users can complete operations such as video playing, picture browsing, file downloading, file management and the like at a far end through mobile phone application programs anytime and anywhere.
Since the intelligent hardware devices are accessed to the public network through the home router of the user, the intelligent hardware devices do not have public network addresses, which means that the mobile terminal of the user cannot be directly connected with the intelligent hardware devices anytime and anywhere. To solve this problem, the smart hardware device is usually connected to a public network server (e.g. a device management server) through a predetermined domain name of the authentication server and a Transmission Control Protocol (TCP).
The above solution has the following disadvantages:
1. if the intelligent hardware equipment fails to analyze the domain name of the authentication server in the network environment, the intelligent hardware equipment cannot be connected to the equipment management server.
2. If the network environment of the intelligent hardware device limits the TCP 80 port, the intelligent hardware device cannot be connected to the device management server.
3. If the network environment of the user limits the listening port of the equipment management server, the user cannot connect to the equipment management server.
4. If the machine room where the device management server is located has a power failure, and all the intelligent hardware devices execute connection operations simultaneously when the service is restored, SYN Flooding attacks (SYN Flooding) may be caused, so that the device management server cannot work normally.
Disclosure of Invention
The invention mainly aims to provide a server connection method, electronic equipment, a system and a medium, and aims to solve the problem of connection between hardware equipment and a server in a complex network environment and further improve the success rate of connection between the hardware equipment and the server.
In order to achieve the above object, the present invention provides a server connection method, including:
determining each hardware device to be connected when a server connection instruction is received;
respectively carrying out random time delay on the connection operation of each hardware device;
for each hardware device, when the hardware device is detected to delay, analyzing a first IP address of the authentication server;
when the first IP address fails to be resolved, randomly acquiring a second IP address from preset operator IP addresses;
when the second IP address is available, randomly acquiring a target protocol from preset protocols;
requesting, based on the second IP address, the authentication server to assign a third IP address of a target server using the target protocol;
when the third IP address is obtained, randomly obtaining a target port from a preset port list;
and controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
Preferably, the method further comprises:
and when the second IP address is unavailable, prohibiting the second IP address from being acquired in the next connection operation.
Preferably, the method further comprises:
and when the third IP address is not acquired, prohibiting the target protocol from being acquired in the next connection operation.
Preferably, the method further comprises:
and when detecting that the hardware equipment is not successfully connected with the target server, forbidding the target port to be acquired in the next connection operation.
Preferably, the method further comprises:
acquiring all used ports;
determining the success rate of the connection operation of all the ports;
acquiring a port with a success rate greater than or equal to a preset threshold;
and configuring the port list according to the acquired port.
Preferably, the method further comprises:
and when the second IP address is unavailable, or the third IP address is not obtained, or the hardware equipment is detected to be unsuccessfully connected with the target server, or the hardware equipment is detected to be disconnected with the target server, re-executing the server connection instruction.
To achieve the above object, the present invention further provides an electronic device, comprising:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the server connection method.
Preferably, the electronic device is a node constituting a content distribution network or a blockchain network.
To achieve the above object, the present invention further provides a server connection system, comprising:
a determination unit configured to determine each hardware device to be connected when receiving a server connection instruction;
the delay unit is used for respectively carrying out random delay on the connection operation of each hardware device;
the analysis unit is used for analyzing the first IP address of the authentication server when detecting that the delay of each hardware device is finished;
the acquisition unit is used for randomly acquiring a second IP address from preset operator IP addresses when the first IP address fails to be analyzed;
the acquiring unit is further configured to randomly acquire a target protocol from preset protocols when the second IP address is available;
a requesting unit, configured to request, based on the second IP address, the authentication server to allocate a third IP address of a target server by using the target protocol;
the obtaining unit is further configured to randomly obtain a target port from a preset port list when the third IP address is obtained;
and the control unit is used for controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
Preferably, the system further comprises:
a prohibiting unit configured to prohibit the second IP address from being acquired in a next connection operation when the second IP address is unavailable.
Preferably, the prohibiting unit is further configured to prohibit the target protocol from being acquired in a next connection operation when the third IP address is not acquired.
Preferably, the prohibiting unit is further configured to prohibit the target port from being acquired in a next connection operation when it is detected that the hardware device is not successfully connected to the target server.
Preferably, the acquiring unit is further configured to acquire all used ports;
the determining unit is further configured to determine a success rate of connection operations of all the ports;
the acquiring unit is further configured to acquire a port with a success rate greater than or equal to a preset threshold;
the system further comprises:
and the configuration unit is used for configuring the port list according to the acquired port.
Preferably, the system further comprises:
and the execution unit is used for re-executing the server connection instruction when the second IP address is unavailable, or the third IP address is not obtained, or the hardware equipment is detected to be unsuccessfully connected with the target server, or the hardware equipment is detected to be disconnected from the target server.
To achieve the above object, the present invention further provides a computer program product comprising computer instructions which, when run on a computer, make the computer execute the server connection method.
In summary, the present invention can determine each hardware device to be connected when a server connection instruction is received, and perform random delay on connection operation of each hardware device, for each hardware device, when it is detected that the hardware device delay is finished, analyze a first IP address of an authentication server, when the first IP address analysis fails, randomly obtain a second IP address from a preset operator IP address, when the second IP address is available, randomly obtain a target protocol from the preset protocol, further based on the second IP address, use the target protocol to request the authentication server to allocate a third IP address of a target server, when the third IP address is obtained, randomly obtain a target port from a preset port list, and control the hardware device to connect to the target server through the target port and the third IP address, and then solve the connection problem of hardware equipment and server under the complicated network environment, has improved the success rate that hardware equipment and server are connected.
Drawings
FIG. 1 is a schematic flow chart of an embodiment of the present invention;
fig. 2 is a schematic diagram of an internal structure of an electronic device according to an embodiment of the disclosure;
FIG. 3 is a functional block diagram of a server connection system according to the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Description of the main elements
Figure BDA0002152978420000051
Figure BDA0002152978420000061
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. 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.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
The invention provides a server connection method.
Referring to fig. 1, fig. 1 is a schematic flow chart according to an embodiment of the invention. The order of the steps in the flow diagram can be changed and some steps can be omitted according to different requirements.
The server connection method is applied to one or more electronic devices, wherein the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and hardware devices of the electronic devices include but are not limited to microprocessors, Application Specific Integrated Circuits (ASICs), Programmable Gate arrays (FPGAs), Digital Signal Processors (DSPs), embedded devices, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network servers.
The Network where the electronic device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
In one embodiment, the method comprises:
s10, when the server connection instruction is received, each hardware device to be connected is determined.
In at least one embodiment of the invention, all the hardware devices comprise intelligent hardware devices, such as a guest playing cloud and the like. By the hardware equipment, sharing of network resources can be realized.
In at least one embodiment of the invention, when detecting that a hardware device is connected to the electronic device, the electronic device determines that the server connection instruction is received.
And S11, respectively carrying out random time delay on the connection operation of each hardware device.
For example: when 3 hardware devices are connected simultaneously, the electronic device can control the 3 hardware devices to randomly delay for 10 seconds, 20 seconds and 30 seconds respectively.
Through the implementation mode, all the hardware devices can execute the connection operation on the target server at different time respectively, the phenomenon that too many hardware devices are simultaneously connected with the target server at the same time to cause operation pressure on the target server is avoided, and SYN Flooding attack (SYN Flooding) on the target server is further effectively avoided.
S12, for each hardware device, when it is detected that the hardware device is delayed, analyzing a first IP Address (Internet Protocol Address) of the authentication server.
In at least one embodiment of the invention, the authentication server may include a Portal server for assigning the IP address of the target server.
And S13, when the first IP address fails to be resolved, randomly acquiring a second IP address from preset operator IP addresses.
In at least one embodiment of the present invention, because the first IP address may not be successfully resolved due to the influence of a network environment, in order to avoid that the hardware device cannot connect to the target server due to failure of resolving the first IP address, when the first IP address fails to resolve, the electronic device randomly obtains a second IP address from a preset operator IP address, and replaces the first IP address with the second IP address.
In at least one embodiment of the invention, the method further comprises:
the electronic device pre-configures the operator IP.
Specifically, the electronic device may configure one IP for each operator, so that although the current operator cannot be confirmed, the probability of IP adaptation can be effectively improved through repeated experiments, and the probability of server connection is further improved.
And S14, when the second IP address is available, randomly acquiring a target protocol from preset protocols.
In at least one embodiment of the present invention, the preset Protocol may include an HTTP Protocol (Hyper Text Transfer Protocol) and an HTTPs Protocol (Hyper Text Transfer Protocol over Secure Socket).
In at least one embodiment of the invention, the second IP address is not necessarily available due to the influence of the network environment.
Thus, the method further comprises:
when the second IP address is not available, the electronic equipment prohibits the second IP address from being acquired in the next connection operation.
By the implementation mode, the situation that unavailable IP addresses are repeatedly acquired and connection progress is delayed can be effectively avoided.
S15, based on the second IP address, adopting the target protocol to request the authentication server to distribute a third IP address of the target server.
In at least one embodiment of the invention, the third IP address is used to connect to the target server.
And S16, when the third IP address is obtained, randomly obtaining a target port from a preset port list.
In at least one embodiment of the present invention, the port list stores ports that are proven to be connected to higher power.
Specifically, the configuring, by the electronic device, the port list includes:
the electronic equipment acquires all used ports and determines the success rate of connection operation of all the ports, the electronic equipment acquires the ports with the success rate larger than or equal to a preset threshold value, and the port list is configured according to the acquired ports.
The preset threshold may be configured in a customized manner, for example, for better connection with the target server, the electronic device may configure the higher preset threshold, and the preset threshold may be configured to be 95%.
In at least one embodiment of the invention, the third IP address is likely to be unavailable due to the network environment.
Thus, the method further comprises:
when the third IP address is not acquired, the electronic equipment prohibits the target protocol from being acquired in the next connection operation.
Through the implementation mode, the invalid target protocol can be effectively prevented from being repeatedly used, and the connection efficiency is further improved.
And S17, controlling the hardware device to connect with the target server through the target port and the third IP address.
In at least one embodiment of the present invention, the target server is a public network server, and the hardware device is controlled to connect to the target server, so that the hardware device and the target server are in a connection controlled state, and thus when a user opens a corresponding application program of the mobile terminal, the mobile terminal can access other remote hardware devices through the target server, so that the mobile terminal of the user can connect to the hardware device anytime and anywhere.
In at least one embodiment of the invention, the hardware device is likely to fail to connect with the target server due to the influence of the network environment.
Thus, the method further comprises:
and when detecting that the hardware equipment is not successfully connected with the target server, the electronic equipment prohibits the target port from being acquired in the next connection operation.
By the implementation mode, the situation that the unavailable target port is repeatedly acquired and the connection progress is delayed can be effectively avoided.
In at least one embodiment of the present invention, when there is a flow operation failure in the above-mentioned flow, in order to avoid a logic error, which results in that the hardware device cannot normally connect to the target server, the method further includes:
and when the preset event is detected, the electronic equipment re-executes the server connection instruction.
In at least one embodiment of the present invention, the preset event may include, but is not limited to, one or more of the following:
(1) the second IP address is not available.
(2) The electronic device does not acquire the third IP address.
(3) The electronic device detects that the hardware device is not successfully connected to the target server.
(4) The electronic device detects that the hardware device is disconnected from the target server.
(5) And the electronic equipment detects that the connection between the hardware equipment and the target server is abnormal.
Through the implementation mode, the server connection instruction can be re-executed when the abnormal event is detected, and the influence on the normal use of the network resources by the user and the influence on the user experience can be avoided by taking response measures in time.
In summary, the present invention can determine each hardware device to be connected when a server connection instruction is received, and perform random delay on connection operation of each hardware device, for each hardware device, when it is detected that the hardware device delay is finished, analyze a first IP address of an authentication server, when the first IP address analysis fails, randomly obtain a second IP address from a preset operator IP address, when the second IP address is available, randomly obtain a target protocol from the preset protocol, further based on the second IP address, use the target protocol to request the authentication server to allocate a third IP address of a target server, when the third IP address is obtained, randomly obtain a target port from a preset port list, and control the hardware device to connect to the target server through the target port and the third IP address, and then solve the connection problem of hardware equipment and server under the complicated network environment, has improved the success rate that hardware equipment and server are connected.
Referring to fig. 2, in the present embodiment, the electronic device 1 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware devices include, but are not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device 1 may also be, but not limited to, any electronic product that can perform human-Computer interaction with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device, for example, a Personal Computer (PC), a tablet Computer, a smart phone, a Personal Digital Assistant (PDA), a game console, an interactive web Television (IPTV), an intelligent wearable device, a palm Computer, a portable Computer, an intelligent router, an mining machine, a network storage device terminal device, a desktop Computer, a cloud server, or other computing devices.
The Network where the electronic device 1 is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
The electronic device 1 may be a node constituting a content distribution network or a blockchain network.
The electronic device 1 may comprise a memory 12, a processor 13 and a bus, and may further comprise a computer program, such as a server connectivity program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation to the electronic device 1, and may comprise more or less components than those shown, or some components may be combined, or different components, for example, the electronic device 1 may further comprise an input output device, a network access device, etc.
The memory 12 includes at least one type of readable storage medium, which includes flash memory, a removable hard drive, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 12 may in some embodiments be an internal storage unit of the electronic device 1, for example a removable hard disk of the electronic device 1. The memory 12 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk provided on the electronic device 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on. Further, the memory 12 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 12 may be used not only to store application software installed in the electronic apparatus 1 and various types of data such as codes of a server connection program, etc., but also to temporarily store data that has been output or is to be output.
The processor 13 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 12 or Processing data, such as executing a server connection program.
The processor 13 executes an operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the above-described respective server connection method embodiments, such as steps S10, S11, S12, S13, S14, S15, S16, S17 shown in fig. 1.
Alternatively, the processor 13 implements the functions of the modules/units in the above-mentioned apparatus embodiments when executing the computer program, for example, when receiving a server connection instruction, determining each hardware device to be connected; respectively carrying out random time delay on the connection operation of each hardware device; for each hardware device, when the hardware device is detected to delay, analyzing a first IP address of the authentication server; when the first IP address fails to be resolved, randomly acquiring a second IP address from preset operator IP addresses; when the second IP address is available, randomly acquiring a target protocol from preset protocols; requesting, based on the second IP address, the authentication server to assign a third IP address of a target server using the target protocol; when the third IP address is obtained, randomly obtaining a target port from a preset port list; and controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one arrow is shown in FIG. 2, but this does not indicate only one bus or one type of bus.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 12 and executed by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a determining unit 110, a delaying unit 111, a parsing unit 112, an obtaining unit 113, a requesting unit 114, a controlling unit 115, a prohibiting unit 116, a configuring unit 117 and an executing unit 118.
Further, the electronic device may further include a network interface, which may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), and is generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, the user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
Fig. 2 only shows the electronic device 1 with the components 12-13, and the server connection program, and it will be understood by those skilled in the art that the structure shown in fig. 2 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
With reference to fig. 1, the memory 12 of the electronic device 1 stores a plurality of instructions to implement a server connection method, and the processor 13 can execute the plurality of instructions to implement: determining each hardware device to be connected when a server connection instruction is received; respectively carrying out random time delay on the connection operation of each hardware device; for each hardware device, when the hardware device is detected to delay, analyzing a first IP address of the authentication server; when the first IP address fails to be resolved, randomly acquiring a second IP address from preset operator IP addresses; when the second IP address is available, randomly acquiring a target protocol from preset protocols; requesting, based on the second IP address, the authentication server to assign a third IP address of a target server using the target protocol; when the third IP address is obtained, randomly obtaining a target port from a preset port list; and controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
and when the second IP address is unavailable, prohibiting the second IP address from being acquired in the next connection operation.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
and when the third IP address is not acquired, prohibiting the target protocol from being acquired in the next connection operation.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
and when detecting that the hardware equipment is not successfully connected with the target server, forbidding the target port to be acquired in the next connection operation.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
acquiring all used ports;
determining the success rate of the connection operation of all the ports;
acquiring a port with a success rate greater than or equal to a preset threshold;
and configuring the port list according to the acquired port.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
and when the second IP address is unavailable, or the third IP address is not obtained, or the hardware equipment is detected to be unsuccessfully connected with the target server, or the hardware equipment is detected to be disconnected with the target server, re-executing the server connection instruction.
Fig. 3 is a schematic diagram of functional modules of the server connection system according to the present invention. The server connection system 11 includes a determining unit 110, a delaying unit 111, a parsing unit 112, an obtaining unit 113, a requesting unit 114, a controlling unit 115, a prohibiting unit 116, a configuring unit 117, and an executing unit 118. The module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
When receiving the server connection instruction, the determination unit 110 determines each hardware device to be connected.
In at least one embodiment of the invention, all the hardware devices comprise intelligent hardware devices, such as a guest playing cloud and the like. By the hardware equipment, sharing of network resources can be realized.
In at least one embodiment of the present invention, when it is detected that a hardware device is connected to an electronic device, the determination unit 110 determines that the server connection instruction is received.
The delay unit 111 performs random delay on the connection operation of each hardware device.
For example: when there are 3 hardware devices connected simultaneously, the delay unit 111 may control the 3 hardware devices to randomly delay for 10 seconds, 20 seconds, and 30 seconds, respectively.
Through the implementation mode, all the hardware devices can execute the connection operation on the target server at different time respectively, the phenomenon that too many hardware devices are simultaneously connected with the target server at the same time to cause operation pressure on the target server is avoided, and SYN Flooding attack (SYN Flooding) on the target server is further effectively avoided.
For each hardware device, when detecting that the hardware device delays to end, the parsing unit 112 parses a first IP Address (Internet Protocol Address) of the authentication server.
In at least one embodiment of the invention, the authentication server may include a Portal server for assigning the IP address of the target server.
When the first IP address fails to be resolved, the obtaining unit 113 randomly obtains a second IP address from preset operator IP addresses.
In at least one embodiment of the present invention, because the first IP address may not be successfully resolved due to the influence of a network environment, in order to avoid that the hardware device cannot connect to the target server due to failure of resolving the first IP address, when the first IP address fails to resolve, the obtaining unit 113 randomly obtains a second IP address from a preset operator IP address, and replaces the first IP address with the second IP address.
In at least one embodiment of the invention, the method further comprises:
the configuration unit 117 configures the operator IP in advance.
Specifically, the configuration unit 117 may configure one IP for each operator, so that although the current operator cannot be confirmed, through trial and error, the probability of IP adaptation can be effectively improved, and thus the probability of server connection can be improved.
When the second IP address is available, the obtaining unit 113 randomly obtains a target protocol from preset protocols.
In at least one embodiment of the present invention, the preset Protocol may include an HTTP Protocol (Hyper Text Transfer Protocol) and an HTTPs Protocol (Hyper Text Transfer Protocol over Secure Socket).
In at least one embodiment of the invention, the second IP address is not necessarily available due to the influence of the network environment.
Thus, the method further comprises:
when the second IP address is not available, the prohibiting unit 116 prohibits the second IP address from being acquired in the next connection operation.
By the implementation mode, the situation that unavailable IP addresses are repeatedly acquired and connection progress is delayed can be effectively avoided.
The requesting unit 114 requests the authentication server to allocate a third IP address of the target server using the target protocol based on the second IP address.
In at least one embodiment of the invention, the third IP address is used to connect to the target server.
When the third IP address is acquired, the acquiring unit 113 randomly acquires a target port from a preset port list.
In at least one embodiment of the present invention, the port list stores ports that are proven to be connected to higher power.
Specifically, the configuring unit 117 configures the port list including:
the configuration unit 117 obtains all used ports and determines the success rate of connection operations of all the ports, and the configuration unit 117 obtains the ports of which the success rate is greater than or equal to a preset threshold, and configures the port list according to the obtained ports.
For example, in order to better connect to the target server, the configuration unit 117 may configure the higher preset threshold, and the preset threshold may be configured to be 95%.
In at least one embodiment of the invention, the third IP address is likely to be unavailable due to the network environment.
Thus, the method further comprises:
when the third IP address is not acquired, the prohibiting unit 116 prohibits the target protocol from being acquired in the next connection operation.
Through the implementation mode, the invalid target protocol can be effectively prevented from being repeatedly used, and the connection efficiency is further improved.
The control unit 115 controls the hardware device to connect to the target server through the target port and the third IP address.
In at least one embodiment of the present invention, the target server is a public network server, and the hardware device is controlled to connect to the target server, so that the hardware device and the target server are in a connection controlled state, and thus when a user opens a corresponding application program of the mobile terminal, the mobile terminal can access other remote hardware devices through the target server, so that the mobile terminal of the user can connect to the hardware device anytime and anywhere.
In at least one embodiment of the invention, the hardware device is likely to fail to connect with the target server due to the influence of the network environment.
Thus, the method further comprises:
when it is detected that the hardware device is not successfully connected to the target server, the prohibiting unit 116 prohibits the target port from being acquired in the next connection operation.
By the implementation mode, the situation that the unavailable target port is repeatedly acquired and the connection progress is delayed can be effectively avoided.
In at least one embodiment of the present invention, when there is a flow operation failure in the above-mentioned flow, in order to avoid a logic error, which results in that the hardware device cannot normally connect to the target server, the method further includes:
when a preset event is detected, the execution unit 118 re-executes the server connection instruction.
In at least one embodiment of the present invention, the preset event may include, but is not limited to, one or more of the following:
(1) the second IP address is not available.
(2) The acquisition unit 113 does not acquire the third IP address.
(3) Detecting that the hardware device is not successfully connected to the target server.
(4) Detecting that the hardware device is disconnected from the target server.
(5) And detecting that the connection between the hardware equipment and the target server is abnormal.
Through the implementation mode, the server connection instruction can be re-executed when the abnormal event is detected, and the influence on the normal use of the network resources by the user and the influence on the user experience can be avoided by taking response measures in time.
In summary, the present invention can determine each hardware device to be connected when a server connection instruction is received, and perform random delay on connection operation of each hardware device, for each hardware device, when it is detected that the hardware device delay is finished, analyze a first IP address of an authentication server, when the first IP address analysis fails, randomly obtain a second IP address from a preset operator IP address, when the second IP address is available, randomly obtain a target protocol from the preset protocol, further based on the second IP address, use the target protocol to request the authentication server to allocate a third IP address of a target server, when the third IP address is obtained, randomly obtain a target port from a preset port list, and control the hardware device to connect to the target server through the target port and the third IP address, and then solve the connection problem of hardware equipment and server under the complicated network environment, has improved the success rate that hardware equipment and server are connected.
In the above embodiments, all or part may be implemented by software, hardware devices, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, removable hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in the form of a hardware device, and can also be realized in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A server connection method, the method comprising:
determining each hardware device to be connected when a server connection instruction is received;
respectively carrying out random time delay on the connection operation of each hardware device;
for each hardware device, when the hardware device is detected to delay, analyzing a first IP address of the authentication server;
when the first IP address fails to be resolved, randomly acquiring a second IP address from preset operator IP addresses;
when the second IP address is available, randomly acquiring a target protocol from preset protocols;
requesting, based on the second IP address, the authentication server to assign a third IP address of a target server using the target protocol;
when the third IP address is obtained, randomly obtaining a target port from a preset port list;
and controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
2. The server connection method of claim 1, wherein the method further comprises:
and when the second IP address is unavailable, prohibiting the second IP address from being acquired in the next connection operation.
3. The server connection method of claim 1, wherein the method further comprises:
and when the third IP address is not acquired, prohibiting the target protocol from being acquired in the next connection operation.
4. The server connection method of claim 1, wherein the method further comprises:
and when detecting that the hardware equipment is not successfully connected with the target server, forbidding the target port to be acquired in the next connection operation.
5. The server connection method of claim 1, wherein the method further comprises:
acquiring all used ports;
determining the success rate of the connection operation of all the ports;
acquiring a port with a success rate greater than or equal to a preset threshold;
and configuring the port list according to the acquired port.
6. The server connection method according to any one of claims 1 to 5, wherein the method further comprises:
and when the second IP address is unavailable, or the third IP address is not obtained, or the hardware equipment is detected to be unsuccessfully connected with the target server, or the hardware equipment is detected to be disconnected with the target server, re-executing the server connection instruction.
7. An electronic device, characterized in that the electronic device comprises:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the server connection method of any one of claims 1 to 6.
8. The electronic device of claim 7, wherein the electronic device is a node that constitutes a content distribution network or a blockchain network.
9. A server connection system, the system comprising:
a determination unit configured to determine each hardware device to be connected when receiving a server connection instruction;
the delay unit is used for respectively carrying out random delay on the connection operation of each hardware device;
the analysis unit is used for analyzing the first IP address of the authentication server when detecting that the delay of each hardware device is finished;
the acquisition unit is used for randomly acquiring a second IP address from preset operator IP addresses when the first IP address fails to be analyzed;
the acquiring unit is further configured to randomly acquire a target protocol from preset protocols when the second IP address is available;
a requesting unit, configured to request, based on the second IP address, the authentication server to allocate a third IP address of a target server by using the target protocol;
the obtaining unit is further configured to randomly obtain a target port from a preset port list when the third IP address is obtained;
and the control unit is used for controlling the hardware equipment to be connected with the target server through the target port and the third IP address.
10. A computer-readable storage medium having stored thereon a server connection program executable by one or more processors to implement the server connection method according to any one of claims 1 to 6.
CN201910708646.8A 2019-08-01 2019-08-01 Server connection method, electronic device, system and medium Active CN110417789B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910708646.8A CN110417789B (en) 2019-08-01 2019-08-01 Server connection method, electronic device, system and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910708646.8A CN110417789B (en) 2019-08-01 2019-08-01 Server connection method, electronic device, system and medium

Publications (2)

Publication Number Publication Date
CN110417789A CN110417789A (en) 2019-11-05
CN110417789B true CN110417789B (en) 2021-12-03

Family

ID=68365122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910708646.8A Active CN110417789B (en) 2019-08-01 2019-08-01 Server connection method, electronic device, system and medium

Country Status (1)

Country Link
CN (1) CN110417789B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110839034B (en) * 2019-11-15 2022-05-13 腾讯科技(深圳)有限公司 Communication connection control method and related equipment
CN111803925B (en) * 2019-12-03 2023-04-18 厦门雅基软件有限公司 Scheduling method and device of forwarding server of cloud game and readable storage medium
CN111082996B (en) * 2019-12-29 2022-05-27 山东英信计算机技术有限公司 Automatic configuration method, device and medium for in-band monitoring software

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101361326A (en) * 2007-03-30 2009-02-04 香港应用科技研究院有限公司 Method of simultaneously providing data to two or more devices on the same network
CN104756126A (en) * 2012-10-29 2015-07-01 三菱电机株式会社 Facility management device, facility management system and program
CN109274735A (en) * 2018-09-11 2019-01-25 腾讯科技(深圳)有限公司 A kind of peer-to-peer network connection method and relevant device
CN109347997A (en) * 2018-12-18 2019-02-15 深圳创维数字技术有限公司 Domain name analytic method, device, server and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107104872B (en) * 2016-02-23 2020-11-03 华为技术有限公司 Access control method, device and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101361326A (en) * 2007-03-30 2009-02-04 香港应用科技研究院有限公司 Method of simultaneously providing data to two or more devices on the same network
CN104756126A (en) * 2012-10-29 2015-07-01 三菱电机株式会社 Facility management device, facility management system and program
CN109274735A (en) * 2018-09-11 2019-01-25 腾讯科技(深圳)有限公司 A kind of peer-to-peer network connection method and relevant device
CN109347997A (en) * 2018-12-18 2019-02-15 深圳创维数字技术有限公司 Domain name analytic method, device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
智能家居系统中网关与服务器如何连接?;黄宝~;《CSDN,https://blog.csdn.net/forebe/article/details/77448888》;20170821;正文第4-11段,图1-2 *

Also Published As

Publication number Publication date
CN110417789A (en) 2019-11-05

Similar Documents

Publication Publication Date Title
US10333975B2 (en) Enhanced computing system security using a secure browser
US11522959B2 (en) Systems and methods for remote management of appliances
US10567841B2 (en) Information interception processing method, terminal, and computer storage medium
CN110417789B (en) Server connection method, electronic device, system and medium
CN107809383B (en) MVC-based path mapping method and device
WO2016160595A1 (en) System and method for threat-driven security policy controls
WO2016160599A1 (en) System and method for threat-driven security policy controls
CN111343048B (en) Pressure testing method and device, computer device and storage medium
CN110677493B (en) Service state determination method and device, computer device and storage medium
CN109951562B (en) NAT traversal method and system, electronic device and storage medium
JP2017501517A (en) Method, apparatus, and system for pushing an application program, and device
US20170257382A1 (en) Maintaining dynamic configuration information of a multi-host off-cluster service on a cluster
CN109547449B (en) Safety detection method and related device
US10067862B2 (en) Tracking asynchronous entry points for an application
CN109981415A (en) Condition judgement method, electronic equipment, system and medium
CN110708366A (en) Plug-in process management method, related method and related device
US9483287B2 (en) Communication infrastructure for virtual machines
CN110808974A (en) Data acquisition method and device, computer device and storage medium
US20170171357A1 (en) Apparatus and method for assisting in downloading file successfully
CN110213132B (en) Network connection method, electronic device, system and medium
CN110535977B (en) File distribution method and device, computer device and storage medium
CN111147186B (en) Data transmission method and device, computer equipment and storage medium
CN110336823B (en) Task allocation method, electronic device, system and medium based on RTT
CN109068312B (en) Operator data switching method and device, electronic equipment and storage medium
CN109656576B (en) Operating system installation package privilege escalation operation method, electronic device, system and 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
GR01 Patent grant
GR01 Patent grant