Multi-device networking and role dynamic switching method and system
Through multicast technology and random voting algorithm, dynamic equipment discovery and role switching of multi-device networking systems are realized, dynamic and reliability problems of traditional networking systems are solved, hot plugging and adaptive recovery are supported, and system stability and operation and maintenance efficiency are improved.
Patent Information
- Application Number
- CN202510477488.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-08-22
AI Technical Summary
Traditional multi-device networking systems have defects in terms of dynamics, reliability and flexibility, such as inability to efficiently form networks, failures of key nodes affect the system, lack of self-healing capabilities, and inability to support real-time resource scheduling in hot-swap scenarios.
Multicast technology is used to detect equipment, dynamic management and networking are realized through monitoring multicast signaling, voting centers are determined using Ethernet address sorting and random voting algorithms, abnormal recovery is achieved in combination with the status diagnosis module, and device role switching and hot plugging are supported.
It realizes dynamic equipment discovery and hot plugging, improves system stability and operation and maintenance efficiency, supports more terminal equipment access, and automatically recovers when networking is abnormal, without manual intervention.
Smart Images

Figure CN120529329A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of wireless communication and terminal technology, and particularly relates to a multi-device networking and dynamic role switching method and system. Background Art
[0002] With the deepening digital transformation of enterprises and the rapid development of IoT technology, modern enterprise network environments are becoming significantly more complex. Statistics show that the number of terminal devices connected to a typical mid-sized enterprise has increased by 300% compared to five years ago, encompassing over 20 categories, including industrial sensors, smart office terminals, and mobile wearables. This exponential growth in device volume and increasing device heterogeneity poses significant challenges to traditional LAN device discovery and networking mechanisms.
[0003] In this context, traditional multi-device networking systems have exposed a series of key defects in terms of dynamics, reliability and flexibility: First, existing networking systems mainly rely on preset device lists and static topology configurations. The networking process requires advance knowledge of the device information to be networked, and manual network joining is required, which makes it impossible to network efficiently; second, the roles of key / subsidiary nodes are fixed, and failures of key nodes can easily affect the entire system; third, existing networking systems lack local self-healing capabilities, and when network anomalies occur, they cannot adaptively restart under current terminal resources; fourth, they cannot achieve real-time resource scheduling in hot-swap scenarios, and cannot dynamically add subsidiaries and adaptively complete networking. This invention will address these technical pain points and propose an innovative dynamic networking and role switching mechanism to provide basic support for building adaptive and highly available terminal networks. Summary of the Invention
[0004] In view of the shortcomings of the existing technology, the present invention provides a multi-device networking and dynamic role switching method and system that completes device discovery based on multicast, can realize dynamic management of networking terminals, hot plugging of terminal devices, and real-time monitoring of networking status.
[0005] Specifically, a multi-device networking and dynamic role switching method is implemented by at least two terminal devices, which includes the following steps: S1. LAN device discovery: Using the network monitoring method of monitoring multicast signaling, all terminal devices in the current LAN environment join the local multicast network and start monitoring the local multicast network. Then, they parse the multicast signaling received, filter out duplicate terminal nodes, and include new terminal nodes in the management; S2. Determine the voting center: Based on the information of the managed terminal devices, sort the Ethernet addresses of the terminal devices in the networking system in ascending order and determine whether the first Ethernet address after sorting matches the local Ethernet address. If so, the system switches to the voting center; otherwise, it does not respond. S3. Voting: The voting center randomly selects key device nodes from the managed terminals based on a random voting algorithm, and simultaneously completes parameter configuration for the key device nodes and auxiliary device nodes. S4, Status Diagnosis: After each terminal completes the key device / accessory device role switch, it enters the status diagnosis state. By sending multicast signaling for device search at regular intervals, each terminal will update the managed terminal device information and its update time in real time. If it is found that the key device role terminal has not updated information for a long time, it is determined to be abnormal offline and immediately enters the status reset state. S5. Status reset: When entering the status reset state, each subsidiary device node successively removes the "supplementary device role" identifier from the multicast device information. After all subsidiary device role terminals reset the multicast device information, a new round of voting center judgment and voting begins again.
[0006] Multicast, also known as multi-target broadcast or multicast, is a transmission method used in the network that allows the sent message to be sent to a selected subset of all possible destinations, that is, to deliver information to multiple clearly specified addresses.
[0007] Broadcasting refers to broadcasting packets within an IP subnet, which all hosts within the subnet will receive. Broadcasting means the network delivers a copy of the packet to every host on the subnet, regardless of whether they are willing to receive it. Therefore, broadcasting is very limited in scope, operating only within the local subnet. Broadcast transmission is controlled by routers and network devices.
[0008] As a further explanation of the above-mentioned multi-device networking and dynamic role switching method, in step S1, when a new terminal node needs to be added to the networked system, the new terminal node automatically switches to the corresponding mode based on the searched multicast device information. If the "key device role" identifier is found, the "accessory device role" identifier is added to the device information to complete the hot-swap networking of the new terminal.
[0009] As a further explanation of the above-mentioned multi-device networking and dynamic role switching method, in step S1, after the monitoring is turned on, the terminal device search multicast request is sent periodically, and its command format is a JSON string; after receiving the multicast search request, other terminal devices in the local area network multicast their own device information, and their feedback information is a JSON string.
[0010] JSON (JavaScript Object Notation) is a lightweight data exchange format. Based on a subset of ECMAScript (the European Computer Manufacturers Association's JS specification), it uses a text format that is completely independent of programming languages to store and represent data. Its simplicity and clear hierarchical structure make JSON an ideal data exchange language. It's easy for humans to read and write, as well as for machines to parse and generate data, significantly improving network transmission efficiency.
[0011] As a further explanation of the above-mentioned multi-device networking and dynamic role switching method, the device information includes device network address information and the number of discovered and managed devices; the device network address information includes IP, MAC, MASK, and GATEWAY.
[0012] IP is the abbreviation of Internet Protocol, which is the network layer protocol in the TCP / IP system.
[0013] A MAC address is an Ethernet address, also known as a hardware address or physical address, used to identify the location of a network device. A MAC address uniquely identifies a network card on a network. If a device has one or more network cards, each card requires and has a unique MAC address.
[0014] MASK is a subnet mask, also called a network mask, address mask, or subnet mask. It is used to indicate which bits of an IP address identify the subnet where the host is located, and which bits identify the bit mask of the host.
[0015] A gateway is a computer system or device that performs conversion tasks. It is used between two systems with different communication protocols, data formats or languages, or even completely different architectures.
[0016] As a further illustration of the above-mentioned multi-device networking and dynamic role switching method, the device information further includes the status of key device nodes and auxiliary device nodes.
[0017] As a further illustration of the above-mentioned multi-device networking and dynamic role switching method, in step S3, the random voting algorithm refers to a method of using random numbers to randomly vote for key device nodes and the remaining votes are for auxiliary device nodes.
[0018] The multi-device networking and dynamic role switching method of the present invention utilizes multicast technology to achieve the effect of dynamic search and discovery of devices, overcomes the problem that the networking device information in the existing networking system needs to be known in advance, and can realize hot joining of the networking, and a new terminal does not need to re-vote the entire system when joining the networking system; utilizes the uniqueness of the Ethernet address, and synchronizes the status of the terminal devices under management in a sorting manner, and completes the random generation of the "voting center" when multiple terminal devices are networked, which solves the problem that the existing "voting center" is prone to affecting the entire system due to the fixed roles of the key equipment and auxiliary equipment, thereby improving the stability of the system; through status diagnosis and reset, when an abnormality occurs in the key node, the network can be re-established, which solves the problem that in the existing networking system, when the system is abnormal, it cannot complete adaptive restart under the current system resources, resulting in abnormal system function.
[0019] The present invention also provides a multi-device networking and role dynamic switching system, which uses any of the above methods to perform multi-device networking and role dynamic switching, and includes: Device discovery module, used to dynamically search and discover terminal devices by monitoring multicast signaling; The device management module is used to parse the multicast signaling received by the device discovery module, filter out duplicate terminal nodes and include new terminal nodes in the management; The center voting module, based on the terminal device information managed by the device management module, sorts and matches the Ethernet address to further realize the switching of the voting center; The command control module uses TCP service monitoring to perform command control between terminal devices in the network and complete the "voting center" operations including role switching and parameter configuration; The role voting module randomly votes for key devices based on a random voting algorithm, and completes the role switching and parameter configuration operations of key device nodes and auxiliary device nodes through the command control module; The status diagnosis module is used to diagnose whether the key equipment role terminal has not updated information for a long time and determine whether it is an abnormal offline; if it is determined to be an abnormal offline, it will immediately enter the status reset, reset all the auxiliary equipment information of the multicast, and restart a new round of voting center judgment and voting.
[0020] TCP is a connection-oriented, reliable transport layer communication protocol designed to achieve end-to-end reliable data transmission over unreliable IP networks. TCP server listening is the core mechanism by which a server continuously waits for and receives client connection requests through a specific port. Essentially, it establishes an entry point for network communication, laying the foundation for subsequent data transmission.
[0021] In the multi-device networking and role dynamic switching system of the present invention, the device discovery module uses multicast technology to achieve the effect of dynamic search and discovery of devices, overcomes the problem that the networking device information in the existing networking system needs to be known in advance, and can realize hot joining of the network. New terminals join the networking system without re-voting the entire system; the device management module is used to parse the multicast signaling monitored by the device discovery module, filter duplicate terminal nodes and include new terminal nodes in the management, and it receives device information sent by other terminals and records the number of terminals managed by other terminals. When the number of terminals managed by other terminals matches the number of terminals managed by itself, it is determined that all terminals in the current environment have been discovered and included in the management; the central voting module uses the Ethernet address Uniqueness, through the sorting method, the status of the terminal devices included in the management is synchronized, and when multiple terminal devices are networked, the "voting center" is randomly generated, which solves the problem that the existing "voting center" is prone to affect the entire system due to the fixed roles of key devices and auxiliary devices, thereby improving the stability of the system; the role voting module randomly generates a "voting center" to complete the voting of each terminal role, and at the same time completes the role switching and parameter configuration operations of the key device nodes and auxiliary device nodes through the command control module; the status diagnosis module can re-network when an abnormality occurs in the key node, which solves the problem in the existing networking system that the system cannot complete adaptive restart under the current system resources when an abnormality occurs, resulting in system function abnormality.
[0022] In summary, the present invention has good beneficial effects in scene application, stability and practicality. It completes terminal device discovery through multicast, supports hot joining of terminal devices, and the networking system does not need to re-vote, thereby improving operation and maintenance efficiency and adapting to more usage scenarios; key equipment and auxiliary equipment vote randomly, the networking status can be monitored in real time, and networking anomalies are automatically restored without manual intervention, thereby improving system robustness; it supports dynamic access of more terminal devices and has strong practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is an overall flow chart of the multi-device networking and dynamic role switching method of the present invention.
[0024] Figure 2 This is a device discovery sequence diagram of the multi-device networking and dynamic role switching method of the present invention.
[0025] Figure 3 This is a judgment and voting center and voting flow chart of the multi-device networking and dynamic role switching method of the present invention.
[0026] Figure 4 This is a diagram of the judgment voting center and voting sequence of the multi-device networking and dynamic role switching method of the present invention.
[0027] Figure 5 This is a status diagnosis flow chart of the multi-device networking and dynamic role switching method of the present invention.
[0028] Figure 6 This is a state reset flow chart of the multi-device networking and dynamic role switching method of the present invention.
[0029] Figure 7 This is a schematic diagram of the structural modules of the multi-device networking and dynamic role switching system of the present invention. DETAILED DESCRIPTION
[0030] The present invention will be further described below with reference to specific embodiments. Example 1
[0031] like Figure 1-6 The multi-device networking and dynamic role switching method is completed by at least two terminal devices, and includes the following steps: S1. LAN device discovery: see Figure 2 As shown in the figure, to prevent broadcast storms within the LAN, a network monitoring method for multicast signaling is adopted. All terminal devices in the current LAN environment join the local multicast network and enable monitoring of the local multicast network to listen for multicast signaling. Then, after each terminal node monitors and parses the received multicast signaling, duplicate terminal nodes are filtered out and new terminal nodes are included in management. By receiving device information sent by other terminals, the number of terminals managed by other terminals is recorded. When the number of terminals managed by other terminals matches the number of terminals managed by the terminal itself, it indicates that all terminals in the current environment have been discovered and included in management.
[0032] After monitoring is enabled, all terminal devices in the local area network periodically send terminal device search multicast requests. The command format is a JSON string, in which the command name indicates that the multicast signaling is performing a device search operation. At the same time, other terminal devices in the local area network multicast their own device information after receiving the multicast search request. The feedback information is a JSON string, in which the device information includes the device network address information (including IP, MAC, MASK, GATEWAY, etc.) and the number of discovered and managed devices. For the voted networking system, it also includes the status of key device nodes and auxiliary device nodes.
[0033] When a new terminal node needs to be added to an existing network system, the new terminal node will automatically switch to the corresponding mode based on the searched multicast device information. If the "key device role" identifier is found, the "supplementary device role" identifier will be added to the multicast device information to complete the hot-swap networking of the new terminal.
[0034] This step uses multicast technology to achieve the effect of dynamic search and discovery of devices, overcoming the problem that networking device information in existing networking systems needs to be known in advance, and can realize hot joining of the network. New terminals join the networking system without re-voting the entire system.
[0035] S2. Determine the voting center: see Figure 3 、 4 As shown, according to the terminal device information included in the management, the Ethernet addresses of all terminal devices in the networking system are sorted in positive order, and it is determined whether the first Ethernet address after sorting matches its own Ethernet address. If it matches, it switches to the voting center, otherwise it does not respond.
[0036] S3. Voting: See Figure 3 、 4 As shown, the voting center uses a random voting algorithm, i.e., a random number is taken as the remainder of the total number of managed terminals, and votes for one key device from the managed terminals. The rest are subsidiary devices (for example, if the total number of devices in the networking system is 10, the random number is 22, and the remainder is 2 when taken as the remainder by the total number of terminals, then the device with index 2 in the sorted devices is selected as the key device, and the rest are subsidiary devices). At the same time, the voting center completes parameter configuration of the key device and subsidiary device roles, respectively, so that they enter the corresponding role states. Each terminal device adds the corresponding "key device role" and "supplementary device role" identifiers to the multicast device information based on the configured parameter information.
[0037] In steps S2 and S3, the uniqueness of the Ethernet address is utilized to synchronize the status of the managed terminal devices through sorting, and when multiple terminal devices are networked, the "voting center" is randomly generated. This solves the problem of the existing "voting center" that the failure of the key node is likely to affect the entire system due to the fixed roles of the key equipment and auxiliary equipment, thereby improving the stability of the system.
[0038] S4, Status Diagnosis: See Figure 5 As shown in the figure, after each terminal completes the key device / auxiliary device role switch, it enters the status diagnosis state. By sending multicast signaling for device search at regular intervals, each terminal will update the information of the managed terminal devices and their update time in real time. If it is found that the key device role terminal has not updated the information for a long time (within 5 minutes), it is determined to be abnormal offline and immediately enters the status reset state. S5, Status reset: see Figure 6 As shown, when entering the state reset state, each auxiliary device node will remove the "auxiliary device role" identification of the multicast device information in succession, and monitor the terminal device information that has been included in the management in real time. After all auxiliary device role terminals reset the multicast device information, a new round of voting center judgment and voting will be restarted.
[0039] Through steps S4 and S5, when an abnormality occurs in a key node, the network can be re-established, which solves the problem in the existing networking system that when the system is abnormal, the adaptive restart cannot be completed under the current system resources, resulting in abnormal system functions. Example 2
[0040] like Figure 7 The multi-device networking and dynamic role switching system adopts the method described in Example 1 to perform multi-device networking and dynamic role switching, which includes: Device discovery module, used to dynamically search and discover terminal devices by monitoring multicast signaling; The device management module is used to parse the multicast signaling received by the device discovery module, filter out duplicate terminal nodes and include new terminal nodes in the management; The center voting module, based on the terminal device information managed by the device management module, sorts and matches the Ethernet address to further realize the switching of the voting center; The command control module uses TCP service monitoring to perform command control between terminal devices in the network and complete the "voting center" operations including role switching and parameter configuration; The role voting module randomly votes for key devices based on a random voting algorithm, and completes the role switching and parameter configuration operations of key device nodes and auxiliary device nodes through the command control module; The status diagnosis module is used to diagnose whether the key equipment role terminal has not updated information for a long time and determine whether it is an abnormal offline; if it is determined to be an abnormal offline, it will immediately enter the status reset, reset all the auxiliary equipment information of the multicast, and restart a new round of voting center judgment and voting.
[0041] In the multi-device networking and role dynamic switching system of this embodiment, the device discovery module uses multicast technology to achieve the effect of dynamic search and discovery of devices, overcoming the problem that the networking device information in the existing networking system needs to be known in advance, and can realize hot joining of the network. New terminals join the networking system without re-voting the entire system; the device management module is used to parse the multicast signaling monitored by the device discovery module, filter out duplicate terminal nodes and bring new terminal nodes into management. It receives device information sent by other terminals and records the number of terminals managed by other terminals. When the number of terminals managed by other terminals matches the number of terminals managed by itself, it determines that all terminals in the current environment have been discovered and brought into management; the central voting module uses Ethernet to The uniqueness of the address is determined by sorting the status of the terminal devices under management, and the random generation of the "voting center" when multiple terminal devices are networked solves the problem that the failure of the key node in the existing "voting center" is easy to affect the entire system due to the fixed roles of the key equipment and auxiliary equipment, thereby improving the stability of the system; the role voting module randomly generates the "voting center" to complete the voting of each terminal role, and at the same time completes the role switching and parameter configuration operations of the key device nodes and auxiliary device nodes through the command control module; the status diagnosis module can re-network when an abnormality occurs in the key node, which solves the problem in the existing networking system that the system cannot complete adaptive restart under the current system resources when an abnormality occurs, resulting in abnormal system function.
Claims
1. A multi-device networking and role dynamic switching method, which is completed by at least two terminal devices, characterized in that: The following steps are involved: S1. LAN device discovery: Using the network monitoring method of monitoring multicast signaling, all terminal devices in the current LAN environment join the local multicast network and start monitoring the local multicast network. Then, they parse the multicast signaling received, filter out duplicate terminal nodes, and include new terminal nodes in the management; S2. Determine the voting center: Based on the information of the managed terminal devices, sort the Ethernet addresses of the terminal devices in the networking system in ascending order and determine whether the first Ethernet address after sorting matches the local Ethernet address. If so, the system switches to the voting center; otherwise, it does not respond. S3. Voting: The voting center randomly selects key device nodes from the managed terminals based on a random voting algorithm, and simultaneously completes parameter configuration for the key device nodes and auxiliary device nodes. S4, Status Diagnosis: After each terminal completes the key device / accessory device role switch, it enters the status diagnosis state. By sending multicast signaling for device search at regular intervals, each terminal will update the managed terminal device information and its update time in real time. If it is found that the key device role terminal has not updated information for a long time, it is determined to be abnormal offline and immediately enters the status reset state. S5. Status reset: When entering the status reset state, each auxiliary device node successively removes the "auxiliary device role" identifier from the multicast device information. After all auxiliary device role terminals reset the multicast device information, a new round of voting center judgment and voting begins again.
2. The multi-device networking and dynamic role switching method according to claim 1, characterized in that: In step S1, when a new terminal node needs to be added to the networked system, the new terminal node automatically switches to the corresponding mode based on the searched multicast device information. If the "key device role" identifier is found, the "accessory device role" identifier is added to the device information to complete the hot-swap networking of the new terminal.
3. The multi-device networking and dynamic role switching method according to claim 1, characterized in that: In step S1, after monitoring is started, a terminal device search multicast request is sent periodically, and its command format is a JSON string; after receiving the multicast search request, other terminal devices in the local area network multicast their own device information, and their feedback information is a JSON string.
4. The multi-device networking and dynamic role switching method according to claim 3, characterized in that: The device information includes device network address information and the number of discovered and managed devices; the device network address information includes IP, MAC, MASK, and GATEWAY.
5. The multi-device networking and dynamic role switching method according to claim 3, characterized in that: The device information also includes the status of key device nodes and auxiliary device nodes.
6. The multi-device networking and dynamic role switching method according to claim 1, characterized in that: In step S3, the random voting algorithm refers to a method of using random numbers, where random voting is for key device nodes and the rest of the voting is for auxiliary device nodes.
7. A multi-device networking and role dynamic switching system, which uses the method according to any one of claims 1 to 6 to perform multi-device networking and role dynamic switching, characterized in that: include: Device discovery module, used to dynamically search and discover terminal devices by monitoring multicast signaling; The device management module is used to parse the multicast signaling received by the device discovery module, filter out duplicate terminal nodes and include new terminal nodes in the management; The center voting module, based on the terminal device information managed by the device management module, sorts and matches the Ethernet address to further realize the switching of the voting center; The command control module uses TCP service monitoring to conduct command control between terminal devices in the network and complete "voting center" operations including role switching and parameter configuration; The role voting module randomly votes for key devices based on a random voting algorithm, and completes the role switching and parameter configuration operations of key device nodes and auxiliary device nodes through the command control module; The status diagnosis module is used to diagnose whether the key equipment role terminal has not updated information for a long time and determine whether it is an abnormal offline; if it is determined to be an abnormal offline, it will immediately enter the status reset, reset all the auxiliary equipment information of the multicast, and restart a new round of voting center judgment and voting.