CN110784549A - Network node selection method and device, first network node and storage medium - Google Patents

Network node selection method and device, first network node and storage medium Download PDF

Info

Publication number
CN110784549A
CN110784549A CN201911058282.XA CN201911058282A CN110784549A CN 110784549 A CN110784549 A CN 110784549A CN 201911058282 A CN201911058282 A CN 201911058282A CN 110784549 A CN110784549 A CN 110784549A
Authority
CN
China
Prior art keywords
network
node
network node
nodes
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.)
Pending
Application number
CN201911058282.XA
Other languages
Chinese (zh)
Inventor
李杰绪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN201911058282.XA priority Critical patent/CN110784549A/en
Publication of CN110784549A publication Critical patent/CN110784549A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services

Landscapes

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

Abstract

A network node selection method, comprising: acquiring connection information of a historical proxy node; traversing the historical proxy nodes according to the connection information, and sending a first connection request to each historical proxy node; if the first connection requests fail to respond and the traversal is finished, determining the waiting time; traversing the plurality of second network nodes when the waiting time is up, and selecting a current proxy node from the plurality of second network nodes; sending a second connection request to the current proxy node; when receiving a confirmation response aiming at the second connection request, establishing connection with the current proxy node; and updating the first address information of the first network node into the second address information of the current proxy node, and broadcasting the second address information of the first network node in the DHT network. The invention also provides a network node selection device, a first network node and a storage medium. The invention can solve the technical problem of how to select the proxy node.

Description

Network node selection method and device, first network node and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for selecting a network node, a first network node, and a storage medium.
Background
In a Distributed Hash Table (DHT) network, each network node holds a certain number of other network nodes. The network nodes comprise an external network node and an internal network node, wherein the internal network node can directly access the external network node, but the external network node cannot directly access the internal network node. Because the extranet nodes have the network conditions as the proxy nodes, the intranet nodes can select certain extranet nodes from the stored network nodes as the own proxy nodes and forward data through the proxy nodes, so that the extranet nodes can communicate with the intranet nodes through the proxy nodes.
Therefore, how to select the proxy node is a technical problem to be solved urgently.
Disclosure of Invention
In view of the above, it is desirable to provide a network node selection method, device, first network node and storage medium, which can solve the technical problem of how to select a proxy node.
A first aspect of the present invention provides a network node selection method, the method comprising:
acquiring connection information of a preset number of historical proxy nodes which are successfully connected with a first network node;
traversing the preset number of historical proxy nodes according to the connection information, and sending a first connection request to each historical proxy node;
if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended, determining waiting time;
when the waiting time is up, traversing a plurality of second network nodes stored by the first network node, and selecting a current proxy node from the plurality of second network nodes;
sending a second connection request to the current proxy node;
establishing a connection with the current proxy node upon receiving a confirmation response to the second connection request;
updating the first address information of the first network node to the second address information of the current proxy node, and broadcasting the second address information of the first network node in a DHT (distributed hash table) network.
In a possible implementation manner, the connection information includes connection time or connection success times, and traversing the preset number of historical proxy nodes according to the connection information includes:
traversing the preset number of historical proxy nodes according to the sequence of the connection time from large to small; or the like, or, alternatively,
and traversing the historical proxy nodes with the preset number according to the sequence of the connection success times from large to small.
In one possible implementation, the determining the waiting time includes:
acquiring the number of times that the first network node traverses the plurality of second network nodes before the current time;
and calculating the waiting time according to the times and the initial time.
In one possible implementation, the method further includes:
judging whether the calculated waiting time exceeds the maximum time or not;
and if the calculated waiting time exceeds the maximum time, setting the maximum time as the waiting time.
In one possible implementation, the method further includes:
if the first connection request is successfully responded, determining a target historical proxy node which is successfully responded;
establishing connection with the target historical proxy node;
and updating the first address information of the first network node into the address information of the target historical proxy node.
In one possible implementation, the selecting a current proxy node from the plurality of second network nodes comprises:
sending a consultation request to each second network node, wherein the consultation request is used for requesting to inquire the load and the network delay of the second network node;
receiving the load and network delay returned by each second network node for the consultation request;
according to the plurality of loads, selecting a third network node with the load lower than a preset load threshold value from the plurality of second network nodes;
sequencing the plurality of third network nodes according to the order of the load from high to low;
and according to the plurality of network delays, determining the network node with the shortest network delay from the sequenced plurality of third network nodes as the current proxy node.
In one possible implementation, the method further includes:
in the DHT network, when the first network node is started, detecting the proxy connection state of the first network node;
the obtaining of the connection information of the history agent nodes of the preset number of successfully connected first network nodes includes:
and if the agent connection state indicates that the first network node is not connected with the agent node, acquiring connection information of a preset number of historical agent nodes, wherein the preset number of historical agent nodes is the number of successful connections of the first network node.
A second aspect of the present invention provides a network node selection apparatus, the apparatus comprising:
the acquisition module is used for acquiring the connection information of a preset number of historical proxy nodes which are successfully connected with the first network node;
the first traversal module is used for traversing the preset number of historical proxy nodes according to the connection information;
a sending module, configured to send a first connection request to each history proxy node;
the determining module is used for determining the waiting time if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended;
the second traversal module is used for traversing a plurality of second network nodes stored by the first network node when the waiting time is up;
a selection module for selecting a current proxy node from the plurality of second network nodes;
the sending module is further configured to send a second connection request to the current proxy node;
an establishing module, configured to establish a connection with the current proxy node when receiving a confirmation response to the second connection request;
an updating module, configured to update first address information of the first network node to second address information of the current proxy node;
a broadcasting module, configured to broadcast the second address information of the first network node in a DHT network.
A third aspect of the invention provides a first network node, the electronic device comprising a processor and a memory, the processor being configured to implement the network node selection method when executing a computer program stored in the memory.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the network node selection method.
By the technical scheme, the method and the device can preferentially traverse the historical proxy nodes of the preset number, which are successfully connected with the first network node, and try to connect with each historical proxy node, so that the influence of proxy node change on other network nodes can be reduced, when the traversal of the historical proxy nodes of the preset number fails, the traversal of a plurality of second network nodes stored in the first network node can be considered when waiting time arrives, so that the current proxy node is selected from the plurality of second network nodes and connected, and therefore, the condition of connection failure caused by the local network environment can be reduced through the setting of the waiting time, so that the proxy nodes can be efficiently selected, and meanwhile, the influence on the DHT network is reduced.
Drawings
Fig. 1 is a schematic diagram of a DHT network architecture disclosed in the present invention.
Fig. 2 is a flowchart of a network node selection method according to a preferred embodiment of the present invention.
Fig. 3 is a functional block diagram of a network node selection apparatus according to a preferred embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a first network node according to a preferred embodiment of the present invention.
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," and "third" in the description and claims of this application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, nor should they be construed to indicate or imply the relative importance thereof or the number of technical features indicated. It will be appreciated that the data so used are interchangeable under appropriate circumstances such that the embodiments described herein are capable of being carried out in other sequences than those illustrated or otherwise described herein, and that the features defined as "first", "second" or "third" may explicitly or implicitly include at least one such feature.
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.
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.
Referring to fig. 1, fig. 1 is a schematic diagram of a DHT network architecture according to the disclosure. As shown in fig. 1, the DHT (Distributed Hash Table) network architecture includes a server, a plurality of external network nodes, a router, and a plurality of internal network nodes. It should be noted that the number of the extranet nodes and the intranet nodes shown in fig. 1 is only an example, and the DHT network architecture may include more or less extranet nodes and intranet nodes than those shown in fig. 1, and the present invention is not limited thereto. Wherein, the extranet node and the intranet node both belong to network nodes in a DHT network architecture.
The server is a computer system capable of providing services to other devices (such as an extranet node and an intranet node) in a network. The server stores some information of the external network nodes, such as node identification ID, IP address and port, whether the external network nodes are external network nodes, etc. When a new node needs to join the DHT network, the new node can access the server to acquire some information of the external network nodes, then communicates with the external network nodes according to the information, and then does not need to communicate with the server any more.
The outer network node is not provided with a router, has an outer network IP and can also be an inner network node which is successfully punched.
The intranet nodes are network nodes which are not successful in punching and provided with routers, the intranet nodes can directly access the extranet nodes, but the extranet nodes cannot directly access the intranet nodes.
In a DHT network, each network node holds information of a certain number of other network nodes, and some accessible external network nodes are not present in the network nodes and have network conditions as proxy nodes. In the DHT network, each network node stores information of other network nodes, and therefore, a certain external network node as a proxy node can be known by other network nodes, and thus, the external network node can be made public as a proxy node.
Firstly, an intranet node can establish a TCP long connection, is connected to an extranet node, takes the extranet node as a proxy node, then changes the address of the intranet node into the address corresponding to the extranet node, and informs other network nodes, when the other network nodes store information about the intranet node, the address uses the address of the proxy node, when the other network nodes send the information to the intranet node, the information can be sent to the proxy node, and the proxy node forwards the information to the intranet node, thereby realizing communication.
Referring to fig. 2, fig. 2 is a flowchart illustrating a network node selection method according to a preferred embodiment of the present invention. The order of the steps in the flowchart may be changed, and some steps may be omitted.
S11, the first network node obtains the connection information of the historical proxy nodes with the preset number of successful connection of the first network node.
The first network node may be any intranet node in the DHT network, and the first network node needs to receive information sent by another network node through a proxy node.
As an optional implementation, the method further comprises:
in the DHT network, when the first network node is started, detecting the proxy connection state of the first network node;
the obtaining of the connection information of the history agent nodes of the preset number of successfully connected first network nodes includes:
and if the agent connection state indicates that the first network node is not connected with the agent node, acquiring connection information of a preset number of historical agent nodes, wherein the preset number of historical agent nodes is the number of successful connections of the first network node.
In this alternative embodiment, when the first network node is started, the first network node may detect a proxy connection status of the first network node, where the proxy connection status may indicate that the first network node is not connected with a proxy node (e.g., connection failure, disconnection), or the proxy connection status may indicate that the first network node is connected with a proxy node (i.e., connection success). If the proxy connection state indicates that the first network node is not connected with the proxy node, the first network node needs to acquire connection information of a preset number of historical proxy nodes which are successfully connected with the first network node, so as to reconnect the proxy node.
The historical proxy node refers to a proxy node which is successfully connected with the first network node before the current time.
The first network node may store the relevant information of the historical proxy node in the form of a map graph, where the map graph is a graph with a proxy node identifier as Key, relevant information of the proxy node as value, and a maximum capacity as N, where the value may include, but is not limited to, the identifier of the first network node, connection time for connecting the proxy node, connection success times, a port number, an internal and external network identifier, and the like. The first network node may obtain connection information (e.g., connection time, connection success times) of a preset number (e.g., N) of historical proxy nodes to which the first network node is successfully connected from the map table.
The first network node may also store the information related to the history proxy node in other forms (e.g., a mapping table).
And S12, traversing the preset number of history proxy nodes by the first network node according to the connection information, and sending a first connection request to each history proxy node.
In the invention, because other network nodes also store the relevant address information of the proxy node, if the address information of the proxy node changes, the address information of other network nodes about the first network node will be wrong, and finally the first network node is removed from the routing table of the first network node, so that the change of the DHT network is caused.
Therefore, in order to minimize the change of the address information of the proxy node and ensure the stability of the DHT network, the first network node may traverse the preset number of history proxy nodes according to the connection information, and send the first connection request to each history proxy node. If the connection is successful, the other network nodes storing the information of the historical proxy node do not need to update the information.
Wherein the connection information includes a connection time or a connection success number.
Specifically, the traversing the preset number of historical proxy nodes according to the connection information includes:
traversing the preset number of historical proxy nodes according to the sequence of the connection time from large to small; or the like, or, alternatively,
and traversing the historical proxy nodes with the preset number according to the sequence of the connection success times from large to small.
In this optional implementation, the preset number of historical proxy nodes may be traversed according to a descending order of connection time, or according to a descending order of the connection success times. The larger the connection time is, the closer the connection time is to the current time, the smaller the connection time is, the farther the connection time is from the current time, the larger the connection success frequency is, the larger the reconnection success probability is, the smaller the connection success frequency is, and the smaller the reconnection success probability is. The first network node traverses the preset number of historical proxy nodes according to the sequence of the connection time from large to small or the sequence of the connection success times from large to small, so that the reconnection efficiency and the reconnection success rate can be improved.
S13, if the first connection request fails to respond and the predetermined number of historical proxy nodes are traversed, the first network node determines a waiting time.
In the embodiment of the present invention, if the first network node sends the first connection request to each of the history proxy nodes in the preset number, the response fails, and all the history proxy nodes are traversed and ended, which indicates that the history proxy nodes are unavailable, and another network node needs to be reselected.
As an optional implementation, the method further comprises:
if the first connection request is successfully responded, determining a target historical proxy node which is successfully responded;
establishing connection with the target historical proxy node;
and updating the first address information of the first network node into the address information of the target historical proxy node.
In this optional embodiment, if any one of the first connection requests successfully responds, the first network node may determine a target historical proxy node that successfully responds, and establish a connection with the target historical proxy node, that is, the reconnection succeeds, and at this time, the first address information of the first network node may be updated to the address information of the target historical proxy node. Other network nodes storing the address information of the target historical proxy node need to change the relevant address information, so that the change of the address information of the proxy node can be reduced, and the stability of the DHT network is ensured.
In the invention, if the network environment where the intranet node is located has a problem, the connection of the proxy node is also failed. Therefore, in order to reduce the network cost for reselecting the proxy node, the waiting time can be determined, namely, the reselecting point is performed when the waiting time is reached.
Specifically, the determining the waiting time includes:
acquiring the number of times that the first network node traverses the plurality of second network nodes before the current time;
and calculating the waiting time according to the times and the initial time.
In this alternative embodiment, a plurality of second network nodes, i.e., other network nodes maintained by the first network node, are different from the history agent node. An initial time, such as 1s, may be preset and the wait time may be calculated based on the number of traversals and the initial time. For example, t is kx + a, where t is the waiting time, k is the coefficient, x is the number of times, and a is the initial time. The more the number of connections, the greater the probability of a problem in the network environment, and the longer the waiting time.
As an optional implementation, the method further comprises:
judging whether the calculated waiting time exceeds the maximum time or not;
and if the calculated waiting time exceeds the maximum time, setting the maximum time as the waiting time.
In this alternative embodiment, the waiting time is not too long, a maximum time may be preset, and if the calculated waiting time exceeds the maximum time, the maximum time needs to be set as the waiting time, that is, when the maximum time arrives, the point selection is performed again.
S14, when the waiting time is reached, the first network node traverses a plurality of second network nodes stored in the first network node, and selects a current proxy node from the plurality of second network nodes.
Specifically, the selecting a current proxy node from the plurality of second network nodes includes:
sending a consultation request to each second network node, wherein the consultation request is used for requesting to inquire the load and the network delay of the second network node;
receiving the load and network delay returned by each second network node for the consultation request;
according to the plurality of loads, selecting a third network node with the load lower than a preset load threshold value from the plurality of second network nodes;
sequencing the plurality of third network nodes according to the order of the load from high to low;
and according to the plurality of network delays, determining the network node with the shortest network delay from the sequenced plurality of third network nodes as the current proxy node.
In this embodiment, when the waiting time reaches, the first network node traverses a plurality of second network nodes stored in the first network node, specifically, sends a consultation request to each second network node to obtain a load and a network delay of each second network node, and selects a plurality of third network nodes with lower loads from the consultation requests, and further selects a network node with the shortest network delay from the plurality of third network nodes as a current proxy node, that is, the selected current proxy node is a network node with lower load and the shortest network delay, so that proxy service can be provided to other network nodes better.
S15, the first network node sends a second connection request to the current proxy node.
Wherein the second connection request is a TCP long connection request.
S16, when receiving the acknowledgement response to the second connection request, the first network node establishes a connection with the current proxy node.
S17, the first network node updates the first address information of the first network node to the second address information of the current proxy node, and broadcasts the second address information of the first network node in the DHT network.
In the present invention, since the current proxy node is not a historical proxy node, after the first network node updates the first address information of the first network node to the second address information of the current proxy node, the second address information of the first network node needs to be broadcast in the DHT network, so that other network nodes can store the second address information of the first network node and communicate with the first network node through the second address information.
In the method flow described in fig. 2, a preset number of history proxy nodes to which a first network node is successfully connected may be preferentially traversed, and a connection with each history proxy node is attempted, so that an influence of proxy node change on other network nodes may be reduced. The above description is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and it will be apparent to those skilled in the art that modifications may be made without departing from the inventive concept of the present invention, and these modifications are within the scope of the present invention.
Referring to fig. 3, fig. 3 is a functional block diagram of a network node selection apparatus according to a preferred embodiment of the present invention.
In some embodiments, the network node selection means operates in a first network node. The network node selection means may comprise a plurality of functional modules consisting of program code segments. The program codes of the program segments in the network node selection apparatus may be stored in the memory and executed by at least one processor to perform part or all of the steps in the network node selection method described in fig. 2, which may specifically refer to the relevant description in fig. 2 and are not described herein again.
In this embodiment, the network node selection apparatus may be divided into a plurality of functional modules according to the functions performed by the network node selection apparatus. The functional module may include: an acquisition module 301, a first traversal module 302, a sending module 303, a determination module 304, a second traversal module 305, a selection module 306, a creation module 307, an update module 308, and a broadcast module 309.
The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In some embodiments, the functionality of the modules will be described in greater detail in subsequent embodiments.
An obtaining module 301, configured to obtain connection information of a preset number of historical proxy nodes that are successfully connected to the first network node;
a first traversal module 302, configured to traverse the preset number of historical proxy nodes according to the connection information;
a sending module 303, configured to send a first connection request to each history proxy node;
a determining module 304, configured to determine a waiting time if all the first connection requests fail to respond and the preset number of historical proxy nodes are traversed;
a second traversing module 305, configured to traverse a plurality of second network nodes stored in the first network node when the waiting time is reached;
a selecting module 306 for selecting a current proxy node from the plurality of second network nodes;
the sending module 303 is further configured to send a second connection request to the current proxy node;
an establishing module 307, configured to establish a connection with the current proxy node when receiving a confirmation response to the second connection request;
an updating module 308, configured to update the first address information of the first network node to the second address information of the current proxy node;
a broadcasting module 309, configured to broadcast the second address information of the first network node in a DHT network.
Optionally, the connection information includes connection time or connection success times, and the traversing, by the first traversal module 302, the traversing the preset number of historical proxy nodes according to the connection information includes:
traversing the preset number of historical proxy nodes according to the sequence of the connection time from large to small; or the like, or, alternatively,
and traversing the historical proxy nodes with the preset number according to the sequence of the connection success times from large to small.
Optionally, the determining module 304 determines the waiting time specifically by:
acquiring the number of times that the first network node traverses the plurality of second network nodes before the current time;
and calculating the waiting time according to the times and the initial time.
Optionally, the determining module 304 is further configured to determine whether the calculated waiting time exceeds a maximum time;
and if the calculated waiting time exceeds the maximum time, setting the maximum time as the waiting time.
Optionally, the determining module 304 is further configured to determine, if the first connection request response is successful, a target historical proxy node that responds successfully;
the establishing module 307 is further configured to establish a connection with the target history proxy node;
the updating module 308 is further configured to update the first address information of the first network node to the address information of the target history proxy node.
Specifically, the selecting module 306 selects the current proxy node from the plurality of second network nodes, including:
sending a consultation request to each second network node, wherein the consultation request is used for requesting to inquire the load and the network delay of the second network node;
receiving the load and network delay returned by each second network node for the consultation request;
according to the plurality of loads, selecting a third network node with the load lower than a preset load threshold value from the plurality of second network nodes;
sequencing the plurality of third network nodes according to the order of the load from high to low;
and according to the plurality of network delays, determining the network node with the shortest network delay from the sequenced plurality of third network nodes as the current proxy node.
Optionally, the network node selecting apparatus further includes:
a detection module, configured to detect, in the DHT network, an agent connection state of the first network node when the first network node is started;
the obtaining module 301 is specifically configured to obtain connection information of a preset number of historical proxy nodes that are successfully connected to the first network node if the proxy connection state indicates that the first network node is not connected to a proxy node.
In the network node selection apparatus described in fig. 3, a preset number of history proxy nodes to which a first network node is successfully connected may be preferentially traversed, and a connection with each history proxy node is attempted, so that an influence of proxy node change on other network nodes may be reduced.
As shown in fig. 4, fig. 4 is a schematic structural diagram of a first network node according to a preferred embodiment of the method for selecting a network node of the present invention. The first network node 4 comprises a memory 41, at least one processor 42, a computer program 43 stored in the memory 41 and executable on the at least one processor 42, and at least one communication bus 44.
It will be appreciated by those skilled in the art that the schematic diagram shown in fig. 4 is merely an example of the first network node 4 and does not constitute a limitation of the first network node 4 and may comprise more or less components than shown, or combine some components, or different components, e.g. the first network node 4 may further comprise an input-output device, a network access device, etc.
The first network node 4 may also include, but is not limited to, any electronic product capable of interacting with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game console, an Internet Protocol Television (IPTV), and a smart wearable device. The network in which the first network node 4 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 at least one Processor 42 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 42 may be a microprocessor or the processor 42 may be any conventional processor or the like, said processor 42 being the control center of said first network node 4, connected to the various parts of the whole first network node 4 by means of various interfaces and lines.
The memory 41 may be used for storing the computer programs 43 and/or modules/units, and the processor 42 may implement various functions of the first network node 4 by running or executing the computer programs and/or modules/units stored in the memory 41 and by invoking data stored in the memory 41. The memory 41 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the first network node 4, and the like. Further, the memory 41 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
With reference to fig. 1 and 2, the memory 41 in the first network node 4 stores a plurality of instructions to implement a network node selection method, and the processor 42 may execute the plurality of instructions to implement:
acquiring connection information of a preset number of historical proxy nodes which are successfully connected with a first network node;
traversing the preset number of historical proxy nodes according to the connection information, and sending a first connection request to each historical proxy node;
if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended, determining waiting time;
when the waiting time is up, traversing a plurality of second network nodes stored by the first network node, and selecting a current proxy node from the plurality of second network nodes;
sending a second connection request to the current proxy node;
establishing a connection with the current proxy node upon receiving a confirmation response to the second connection request;
updating the first address information of the first network node to the second address information of the current proxy node, and broadcasting the second address information of the first network node in a DHT (distributed hash table) network.
In an optional implementation manner, the connection information includes connection time or connection success times, and traversing the preset number of historical proxy nodes according to the connection information includes:
traversing the preset number of historical proxy nodes according to the sequence of the connection time from large to small; or the like, or, alternatively,
and traversing the historical proxy nodes with the preset number according to the sequence of the connection success times from large to small.
In an alternative embodiment, the determining the wait time comprises:
acquiring the number of times that the first network node traverses the plurality of second network nodes before the current time;
and calculating the waiting time according to the times and the initial time.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
judging whether the calculated waiting time exceeds the maximum time or not;
and if the calculated waiting time exceeds the maximum time, setting the maximum time as the waiting time.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
if the first connection request is successfully responded, determining a target historical proxy node which is successfully responded;
establishing connection with the target historical proxy node;
and updating the first address information of the first network node into the address information of the target historical proxy node.
In an alternative embodiment, the selecting the current proxy node from the plurality of second network nodes comprises:
sending a consultation request to each second network node, wherein the consultation request is used for requesting to inquire the load and the network delay of the second network node;
receiving the load and network delay returned by each second network node for the consultation request;
according to the plurality of loads, selecting a third network node with the load lower than a preset load threshold value from the plurality of second network nodes;
sequencing the plurality of third network nodes according to the order of the load from high to low;
and according to the plurality of network delays, determining the network node with the shortest network delay from the sequenced plurality of third network nodes as the current proxy node.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
in the DHT network, when the first network node is started, detecting the proxy connection state of the first network node;
and if the agent connection state indicates that the first network node is not connected with the agent node, acquiring connection information of a preset number of historical agent nodes, wherein the preset number of historical agent nodes is the number of successful connections of the first network node.
Specifically, the processor 42 may refer to the description of the relevant steps in the embodiment corresponding to fig. 2, and details thereof are not repeated herein.
In the first network node 4 described in fig. 4, when connection information of a preset number of historical proxy nodes that are successfully connected to the first network node is obtained, traversal may be performed on the preset number of historical proxy nodes according to the connection information, and a first connection request is sent to each historical proxy node; if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended, determining waiting time; when the waiting time is up, traversing a plurality of second network nodes stored by the first network node, and selecting a current proxy node from the plurality of second network nodes; sending a second connection request to the current proxy node; establishing a connection with the current proxy node upon receiving a confirmation response to the second connection request; updating the first address information of the first network node to the second address information of the current proxy node, and broadcasting the second address information of the first network node in a DHT (distributed hash table) network. Therefore, through the invention, the historical proxy nodes can be preferentially traversed and the connection with each historical proxy node is tried, so that the influence of the change of the proxy nodes on other network nodes can be reduced, when the traversal of the historical proxy nodes fails, the traversal of the second network node stored in the first network node can be considered when the waiting time is up, so as to select the current proxy node from the second network node and connect the current proxy node, and therefore, through the setting of the waiting time, the situation of connection failure caused by the local network environment can be reduced, so that the proxy nodes can be efficiently selected, and meanwhile, the influence on the DHT network is reduced.
The modules/units integrated by the first network node 4 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, U-disk, removable hard disk, magnetic disk, optical disk, computer memory, and Read-only memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention 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 a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method of network node selection, the method comprising:
acquiring connection information of a preset number of historical proxy nodes which are successfully connected with a first network node;
traversing the preset number of historical proxy nodes according to the connection information, and sending a first connection request to each historical proxy node;
if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended, determining waiting time;
when the waiting time is up, traversing a plurality of second network nodes stored by the first network node, and selecting a current proxy node from the plurality of second network nodes;
sending a second connection request to the current proxy node;
establishing a connection with the current proxy node upon receiving a confirmation response to the second connection request;
updating the first address information of the first network node to the second address information of the current proxy node, and broadcasting the second address information of the first network node in a DHT (distributed hash table) network.
2. The method of claim 1, wherein the connection information includes connection time or connection success times, and wherein traversing the preset number of historical proxy nodes according to the connection information includes:
traversing the preset number of historical proxy nodes according to the sequence of the connection time from large to small; or the like, or, alternatively,
and traversing the historical proxy nodes with the preset number according to the sequence of the connection success times from large to small.
3. The method of claim 1, wherein the determining the latency comprises:
acquiring the number of times that the first network node traverses the plurality of second network nodes before the current time;
and calculating the waiting time according to the times and the initial time.
4. The method of claim 3, further comprising:
judging whether the calculated waiting time exceeds the maximum time or not;
and if the calculated waiting time exceeds the maximum time, setting the maximum time as the waiting time.
5. The method according to any one of claims 1 to 4, further comprising:
if the first connection request is successfully responded, determining a target historical proxy node which is successfully responded;
establishing connection with the target historical proxy node;
and updating the first address information of the first network node into the address information of the target historical proxy node.
6. The method according to any of claims 1 to 4, wherein the selecting a current proxy node from the plurality of second network nodes comprises:
sending a consultation request to each second network node, wherein the consultation request is used for requesting to inquire the load and the network delay of the second network node;
receiving the load and network delay returned by each second network node for the consultation request;
according to the plurality of loads, selecting a third network node with the load lower than a preset load threshold value from the plurality of second network nodes;
sequencing the plurality of third network nodes according to the order of the load from high to low;
and according to the plurality of network delays, determining the network node with the shortest network delay from the sequenced plurality of third network nodes as the current proxy node.
7. The method of claim 1, further comprising:
in the DHT network, when the first network node is started, detecting the proxy connection state of the first network node;
the obtaining of the connection information of the history agent nodes of the preset number of successfully connected first network nodes includes:
and if the agent connection state indicates that the first network node is not connected with the agent node, acquiring connection information of a preset number of historical agent nodes, wherein the preset number of historical agent nodes is the number of successful connections of the first network node.
8. An apparatus for network node selection, the apparatus comprising:
the acquisition module is used for acquiring the connection information of a preset number of historical proxy nodes which are successfully connected with the first network node;
the first traversal module is used for traversing the preset number of historical proxy nodes according to the connection information;
a sending module, configured to send a first connection request to each history proxy node;
the determining module is used for determining the waiting time if the first connection requests fail to respond and the preset number of historical proxy nodes are traversed and ended;
the second traversal module is used for traversing a plurality of second network nodes stored by the first network node when the waiting time is up;
a selection module for selecting a current proxy node from the plurality of second network nodes;
the sending module is further configured to send a second connection request to the current proxy node;
an establishing module, configured to establish a connection with the current proxy node when receiving a confirmation response to the second connection request;
an updating module, configured to update first address information of the first network node to second address information of the current proxy node;
a broadcasting module, configured to broadcast the second address information of the first network node in a DHT network.
9. A first network node, characterized in that the first network node comprises a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the network node selection method according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores at least one instruction which, when executed by a processor, implements the network node selection method according to any one of claims 1 to 7.
CN201911058282.XA 2019-11-01 2019-11-01 Network node selection method and device, first network node and storage medium Pending CN110784549A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911058282.XA CN110784549A (en) 2019-11-01 2019-11-01 Network node selection method and device, first network node and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911058282.XA CN110784549A (en) 2019-11-01 2019-11-01 Network node selection method and device, first network node and storage medium

Publications (1)

Publication Number Publication Date
CN110784549A true CN110784549A (en) 2020-02-11

Family

ID=69388518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911058282.XA Pending CN110784549A (en) 2019-11-01 2019-11-01 Network node selection method and device, first network node and storage medium

Country Status (1)

Country Link
CN (1) CN110784549A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111629051A (en) * 2020-05-26 2020-09-04 北京邮电大学 Performance optimization method and device for industrial internet identification analysis system
CN113301672A (en) * 2021-04-01 2021-08-24 浙江大华技术股份有限公司 Network connection method, network node equipment and device
CN113839820A (en) * 2021-10-14 2021-12-24 福建天晴数码有限公司 Method and system for searching optimal network updating node during service updating
WO2022006876A1 (en) * 2020-07-10 2022-01-13 Oppo广东移动通信有限公司 Communication method and apparatus in body area network, and node, storage medium and chip
CN114024786A (en) * 2022-01-04 2022-02-08 杭州趣链科技有限公司 Message broadcasting method and device, computer equipment and storage medium

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469017A (en) * 2010-11-17 2012-05-23 中兴通讯股份有限公司 Relay selection method and relay control system
EP2530899A1 (en) * 2010-10-19 2012-12-05 Huawei Technologies Co., Ltd. Method and node for obtaining the content and content network
CN103024085A (en) * 2013-01-11 2013-04-03 乐视网信息技术(北京)股份有限公司 System and method for processing P2P (peer-to-peer) node request
CN103857002A (en) * 2012-11-29 2014-06-11 中国电信股份有限公司 Method, device and system for network connection disaster recovery
EP2887620A1 (en) * 2013-12-20 2015-06-24 Alcatel Lucent Session Initiation Protocol Messaging
US20150223190A1 (en) * 2012-08-03 2015-08-06 Telefonaktiebolaget L M Ericsson (Publ) Node and method for determining a packet data network connection anchor point
CN105933408A (en) * 2016-04-20 2016-09-07 ***股份有限公司 Implementation method and device of Redis universal middleware
CN106658378A (en) * 2016-12-29 2017-05-10 中国科学院计算机网络信息中心 Method and system for loading balancing of ecological monitoring IPv6 sensor network
CN107018182A (en) * 2017-03-23 2017-08-04 深圳市创梦天地科技有限公司 The fault-tolerance processing method and device of load balancing
US20180191673A1 (en) * 2016-12-29 2018-07-05 Riverbed Technology, Inc. AUTO DISCOVERY BETWEEN PROXIES IN AN IPv6 NETWORK
US20180295543A1 (en) * 2016-09-30 2018-10-11 Telefonaktiebolaget Lm Ericsson (Publ) Network, Network Nodes and Method Therein for Handling Connection in a Wireless Communication Network
US20180309682A1 (en) * 2017-04-24 2018-10-25 Facebook, Inc. Load balancing based on load projections for events
CN109561160A (en) * 2019-01-28 2019-04-02 众安信息技术服务有限公司 Network-initiating node bootstrap technique and equipment based on distributed hash list
CN109639582A (en) * 2018-12-07 2019-04-16 大科数据(深圳)有限公司 A kind of network node treatment method and device based on distributed hashtable
CN110022375A (en) * 2019-04-19 2019-07-16 宜人恒业科技发展(北京)有限公司 The distribution method and device of agent node
CN110191204A (en) * 2019-05-30 2019-08-30 深圳市网心科技有限公司 A kind of Intranet communication between devices method, system, device and computer storage medium
CN110351309A (en) * 2018-04-02 2019-10-18 中国科学院上海微***与信息技术研究所 Calculating task unloading balance method, system, medium and equipment between network node

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2530899A1 (en) * 2010-10-19 2012-12-05 Huawei Technologies Co., Ltd. Method and node for obtaining the content and content network
CN102469017A (en) * 2010-11-17 2012-05-23 中兴通讯股份有限公司 Relay selection method and relay control system
US20150223190A1 (en) * 2012-08-03 2015-08-06 Telefonaktiebolaget L M Ericsson (Publ) Node and method for determining a packet data network connection anchor point
CN103857002A (en) * 2012-11-29 2014-06-11 中国电信股份有限公司 Method, device and system for network connection disaster recovery
CN103024085A (en) * 2013-01-11 2013-04-03 乐视网信息技术(北京)股份有限公司 System and method for processing P2P (peer-to-peer) node request
EP2887620A1 (en) * 2013-12-20 2015-06-24 Alcatel Lucent Session Initiation Protocol Messaging
CN105933408A (en) * 2016-04-20 2016-09-07 ***股份有限公司 Implementation method and device of Redis universal middleware
US20180295543A1 (en) * 2016-09-30 2018-10-11 Telefonaktiebolaget Lm Ericsson (Publ) Network, Network Nodes and Method Therein for Handling Connection in a Wireless Communication Network
CN106658378A (en) * 2016-12-29 2017-05-10 中国科学院计算机网络信息中心 Method and system for loading balancing of ecological monitoring IPv6 sensor network
US20180191673A1 (en) * 2016-12-29 2018-07-05 Riverbed Technology, Inc. AUTO DISCOVERY BETWEEN PROXIES IN AN IPv6 NETWORK
CN107018182A (en) * 2017-03-23 2017-08-04 深圳市创梦天地科技有限公司 The fault-tolerance processing method and device of load balancing
US20180309682A1 (en) * 2017-04-24 2018-10-25 Facebook, Inc. Load balancing based on load projections for events
CN110351309A (en) * 2018-04-02 2019-10-18 中国科学院上海微***与信息技术研究所 Calculating task unloading balance method, system, medium and equipment between network node
CN109639582A (en) * 2018-12-07 2019-04-16 大科数据(深圳)有限公司 A kind of network node treatment method and device based on distributed hashtable
CN109561160A (en) * 2019-01-28 2019-04-02 众安信息技术服务有限公司 Network-initiating node bootstrap technique and equipment based on distributed hash list
CN110022375A (en) * 2019-04-19 2019-07-16 宜人恒业科技发展(北京)有限公司 The distribution method and device of agent node
CN110191204A (en) * 2019-05-30 2019-08-30 深圳市网心科技有限公司 A kind of Intranet communication between devices method, system, device and computer storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
吴大鹏等: "带有节点状态估计的间断连接无线网络缓存管理策略", 《电子与信息学报》 *
姚尹雄等: "一种基于中心代理的移动Ad-Hoc网络接入方法", 《通信学报》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111629051A (en) * 2020-05-26 2020-09-04 北京邮电大学 Performance optimization method and device for industrial internet identification analysis system
WO2022006876A1 (en) * 2020-07-10 2022-01-13 Oppo广东移动通信有限公司 Communication method and apparatus in body area network, and node, storage medium and chip
CN113301672A (en) * 2021-04-01 2021-08-24 浙江大华技术股份有限公司 Network connection method, network node equipment and device
CN113839820A (en) * 2021-10-14 2021-12-24 福建天晴数码有限公司 Method and system for searching optimal network updating node during service updating
CN113839820B (en) * 2021-10-14 2023-08-11 福建天晴数码有限公司 Method and system for searching optimal network updating node during updating service
CN114024786A (en) * 2022-01-04 2022-02-08 杭州趣链科技有限公司 Message broadcasting method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110784549A (en) Network node selection method and device, first network node and storage medium
CN109315004B (en) PDU type setting method and related entity
CN110049087B (en) Credibility verification method, system, device and equipment of alliance chain
CN109428749B (en) Network management method and related equipment
US20220141311A1 (en) Resource subscription method, device and server, and computer storage medium
US10630551B2 (en) Method and apparatus for automatic networking of gateway device
CN106210155B (en) Method and device for connecting application server
CN110046901B (en) Credibility verification method, system, device and equipment of alliance chain
CN109688214B (en) Data transmission method, device and storage medium
CN107087041B (en) Method and device for statically binding IP address to DHCP client
CN111046110B (en) Method, node and computing device for node management of blockchain system
CN109561054B (en) Data transmission method, controller and access device
CN112600693B (en) Service request processing method, system, electronic equipment and computer storage medium
CN110971702A (en) Service calling method and device, computer equipment and storage medium
CN111131484A (en) Node mounting method, device, network node and storage medium
CN104426816B (en) A kind of virtual machine communication method and device
CN111064798B (en) Node network access method, device, client node and storage medium
US10637748B2 (en) Method and apparatus for establishing interface between VNFMS, and system
CN107534598B (en) Media service agent method, equipment and system
CN112148320A (en) Application program upgrading method, device, equipment and storage medium
CN115460160A (en) Network communication method, system, storage medium and switch based on Full-Mesh networking
JP2010128512A (en) Information communication system, and software updating method
CN104869532B (en) Group member management method and device
CN113596792A (en) Binding method and device of electronic equipment, storage medium and electronic device
WO2017003892A1 (en) Circumventing wireless device spatial tracking based on wireless device identifiers

Legal Events

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

Application publication date: 20200211