Device communication processing method and apparatus, electronic device, system, and storage medium
By detecting whether the upstream routing address of a network device matches the routing path, the problem of devices being misidentified as different local area networks is solved, and efficient communication and quality improvement between devices are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, determining whether devices are on the same local area network by checking if their BSSIDs are the same can lead to misjudgments, resulting in devices being unable to communicate effectively and affecting communication quality.
By obtaining the routing addresses of the upstream devices that different network devices pass through on the corresponding routing paths, and detecting whether there are matching upstream routing addresses, it is possible to determine whether the devices are in the same local area network, and establish a communication link when a match is found.
It improves the communication quality and response speed between devices, avoids misjudgments, and ensures that devices can communicate directly point-to-point within the same local area network.
Smart Images

Figure CN114900848B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent control technology, and in particular to a device communication processing method, apparatus, electronic device, system, and storage medium. Background Technology
[0002] With the continuous development of intelligent control technology, smart devices are becoming increasingly common, and the quality of communication between devices, such as speed, directly affects the user experience. Specifically, when different devices are within the same local area network (LAN), point-to-point communication within the LAN can shorten communication links and improve communication speed.
[0003] Current methods for determining whether different devices are on the same local area network (LAN) primarily rely on whether their Basic Service Set Identifiers (BSSIDs) are identical. If different devices have different BSSIDs, they are considered not to be on the same LAN. Taking smart home devices as an example, if two gateway devices connect to the network through different access points or different connection methods, their corresponding BSSIDs will be different, easily leading to the conclusion that these two gateways are not on the same LAN and cannot communicate. However, in some situations, these two gateway devices are actually on the same LAN. Therefore, the above method for determining whether different devices are on the same LAN is not comprehensive enough and is prone to misjudgment, resulting in different devices being unable to communicate through the LAN and affecting the quality of communication between devices. Summary of the Invention
[0004] Therefore, it is necessary to provide a device communication processing method, apparatus, electronic device, system, and storage medium that can improve communication quality in response to the above-mentioned technical problems.
[0005] In a first aspect, embodiments of this application provide a device communication processing method applied to a server, the method comprising:
[0006] Obtain at least one first upstream routing address corresponding to the first network device, and obtain at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device traversed by the first network device on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device traversed by the second network device on the corresponding routing path.
[0007] If at least one of the first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address, then a communication link between the first network device and the second network device is established based on the matching upper-level routing address.
[0008] Secondly, embodiments of this application provide a device communication processing method, applied to a first network device, the method comprising:
[0009] Obtain at least one first superior routing address, wherein the first superior routing address includes the routing address corresponding to at least one superior device that the first network device passes through on the corresponding routing path;
[0010] If the at least one first upper-level routing address includes a target routing address, a communication link with the second network device is established based on the target routing address; the target routing address is the upper-level routing address that matches the at least one first upper-level routing address and the at least one second upper-level routing address corresponding to the second network device; wherein, the second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0011] Thirdly, embodiments of this application provide a device communication processing apparatus applied to a server, the apparatus comprising:
[0012] The first acquisition module is used to acquire at least one first upstream routing address corresponding to the first network device and to acquire at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device traversed by the first network device on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device traversed by the second network device on the corresponding routing path.
[0013] The first processing module is configured to establish a communication link between the first network device and the second network device based on the matching upper-level routing address if at least one of the first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address.
[0014] Fourthly, embodiments of this application provide a device communication processing apparatus applied to a first network device, the apparatus comprising:
[0015] The second acquisition module is used to acquire at least one first superior routing address, wherein the first superior routing address includes the routing address corresponding to at least one superior device that the first network device passes through on the corresponding routing path;
[0016] The second processing module is configured to establish a communication link with the second network device based on the target routing address if the at least one first upper-level routing address includes the target routing address; the target routing address is the upper-level routing address that matches the at least one first upper-level routing address and the at least one second upper-level routing address corresponding to the second network device; wherein the second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0017] Fifthly, embodiments of this application provide a device communication processing system, characterized in that it includes: a server, a first network device, and a second network device;
[0018] The first network device is configured to obtain at least one first upper-level routing address and send the at least one first upper-level routing address to the server. The first upper-level routing address includes the routing address corresponding to at least one upper-level device that the first network device passes through on the corresponding routing path.
[0019] The second network device is configured to obtain at least one second upper-level routing address and send the at least one second upper-level routing address to the server. The second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0020] The server is configured to establish a communication link between the first network device and the second network device based on the matching upper-level routing address if at least one of the at least first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address.
[0021] Sixthly, embodiments of this application provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable by the processor. When the computer program is executed by the processor, it implements the device communication processing method described in any embodiment of this application.
[0022] In a seventh aspect, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the device communication processing method described in any embodiment of this application.
[0023] The aforementioned device communication processing method, apparatus, electronic device, system, and storage medium detect whether at least one matching upstream routing address exists between the routing addresses of at least one upstream device traversed by the first network device on its corresponding routing path and the routing addresses of at least one upstream device traversed by the second network device on its corresponding routing path. If at least one matching upstream routing address exists, it is determined that the first network device and the second network device are within the same local area network (LAN), thereby establishing a communication link between them. Thus, based on the routing addresses of upstream devices traversed on the corresponding routing paths of different network devices, when a matching upstream routing address is detected (i.e., different network devices are within the same LAN), a communication link is established between the different network devices, thereby shortening the communication link for communication between different network devices, improving response speed, and ultimately enhancing communication quality. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the structure of an existing smart home system;
[0025] Figure 2 This is a schematic diagram of the application environment of the device communication processing method in one embodiment;
[0026] Figure 3 This is a flowchart illustrating a device communication processing method in one embodiment;
[0027] Figure 4 This is a flowchart illustrating a device communication processing method in another embodiment;
[0028] Figure 5 This is a structural block diagram of a device communication processing apparatus in one embodiment;
[0029] Figure 6 This is a structural block diagram of the device communication processing apparatus in another embodiment;
[0030] Figure 7 This is a schematic diagram of the device communication system in one embodiment;
[0031] Figure 8 This is an interactive schematic diagram of a device communication processing method in one embodiment;
[0032] Figure 9 This is a schematic diagram of the device communication system in another embodiment;
[0033] Figure 10 This is an interactive schematic diagram of a device communication processing method in one embodiment;
[0034] Figure 11 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0036] With the increasing popularity of smart homes, many individual users have emerged. Communication stability and speed directly impact after-sales service and user experience. The primary communication methods are Zigbee and Wi-Fi. Devices within the same gateway use Zigbee, while devices across different gateways use Wi-Fi. (See also...) Figure 1 In smart home systems, routers connect to a public server (cloud) via a wide area network (WAN) or Ethernet. The cloud can be a cloud server or a local server. Routers connect to gateway devices (Gn) via Wi-Fi or Ethernet, and Zigbee devices (Zn) connect via a Zigbee network. Devices within the same gateway can interact point-to-point. However, communication between gateway devices typically uses a cloud relay, which results in longer communication links, slower device response times, reliance on the router and public server connection, and inability to communicate offline. If all gateway devices are on the same Wi-Fi LAN, point-to-point communication within the LAN can resolve the communication issues between gateways; that is, gateway devices under the same router can communicate directly point-to-point. However, with the increase in users' devices, users in large homes often have multiple Wi-Fi LANs on different network segments. Based on existing methods for determining whether different devices are on the same LAN, it's easy to make the mistaken judgment that different gateways on different network segments cannot communicate via the LAN, even when they are actually on the same LAN and can communicate. This forces gateways to use low-quality methods like cloud relays to achieve communication, thus affecting the communication quality between gateways. To address these issues, the inventors, after extensive research, have proposed the device communication processing method, apparatus, electronic device, system, and storage medium provided in this application. Based on the routing addresses of the upstream devices that different network devices traverse on their corresponding routing paths, when a matching upstream routing address is detected (meaning different network devices are on the same LAN), a communication link is established between the different network devices. This shortens the communication link between different network devices, improves response speed, and enhances communication quality, while effectively solving the aforementioned problems.
[0037] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating an application environment applicable to embodiments of this application. The device communication processing method provided in this application embodiment can be applied to, for example... Figure 1The smart home system shown may include server 1, router 2, first network device 3, and second network device 4. Server 1 may be a network access server, database server, cloud server, etc. Server 1 can be a single server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers. Optionally, first network device 3 and second network device 4 can connect to the network based on Wi-Fi or Zigbee protocols and can access server 1 through router 2. Furthermore, first network device 3 and second network device 4 may include, but are not limited to, gateways, routers, mobile terminals, or devices configured with communication modules (such as Wi-Fi modules), such as human body sensors, door and window sensors, temperature and humidity sensors, water immersion sensors, natural gas alarms, smoke alarms, wall switches, wall sockets, wireless switches, wireless wall sticker switches, cube controllers, curtain motors, etc. In this process, after obtaining at least one first upstream routing address corresponding to the first network device 3 and at least one second upstream routing address corresponding to the second network device 4, if at least one of the first upstream routing addresses and at least one second upstream routing address has at least one matching upstream routing address, then a communication link between the first network device 3 and the second network device 4 is established based on the matching upstream routing address. This shortens the communication link between the first network device 3 and the second network device 4, improves the response speed, and thus enhances the communication quality.
[0038] It is understood that the above application environment is merely an exemplary description for the convenience of understanding the following embodiments, and does not constitute any limitation on the actual application environment that can be implemented in the embodiments of this application.
[0039] Please see Figure 3 This application provides a device communication processing method according to an embodiment, which can be applied to... Figure 2 The communication processing method of the server 1 shown includes the following steps:
[0040] Step S101: Obtain at least one first upstream routing address corresponding to the first network device, and obtain at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device that the first network device passes through on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device that the second network device passes through on the corresponding routing path.
[0041] In this context, "network device" refers to a device with network relay or forwarding functions, including but not limited to gateways, routers, mobile terminals, or devices configured with network modules (such as Wi-Fi modules), such as human sensors and switches. "Route address" indicates the address to which a routing expression needs to be routed, including but not limited to network addresses and physical addresses. A network address is the logical address a node on the Internet has, used to determine the location of a network device, and may include but not limited to IP addresses, port numbers, or other protocol network addresses. A physical address identifies a device in the network and may include but not limited to MAC addresses (Media Access Control addresses) or other protocol physical addresses. Optionally, "routing path" refers to the path a network device takes to connect to an external network. "Network layer" indicates the layer a network device occupies in the network system. Other network devices located on the same routing path but at a higher network layer can be called "upper-level devices." For example, suppose a first network device connects to router A, router A connects to router B, and router B ultimately connects to an external Ethernet network. Then, the routing path of the first network device includes router A and router B, and router A and router B are the upper-level devices that the first network device passes through on the corresponding routing path. In other words, the superior routing address represents the routing address of the superior device that the network device passes through on the corresponding routing path.
[0042] It should be noted that the first network device and the second network device can, after successfully connecting to the network, respectively send at least one first upstream routing address corresponding to the first network device and at least one second upstream routing address corresponding to the second network device to the server, or they can, after receiving a trigger command from the server, send at least one first upstream routing address corresponding to the first network device and at least one second upstream routing address corresponding to the second network device to the server, respectively. For example, based on user-configured automation or scenario information, if the server detects that the first network device and the second network device are associated, or that the first network device and a device under the second network device are associated, or that one of the first network device and the second network device has subscribed to the other's attributes or that they have subscribed to each other, it can send trigger commands to the first network device and the second network device respectively to obtain the routing address corresponding to their upstream devices.
[0043] Step S103: If at least one first upper-level routing address and at least one second upper-level routing address have at least one matching upper-level routing address, then a communication link between the first network device and the second network device is established based on the matching upper-level routing address.
[0044] If at least one first upper-level routing address and at least one second upper-level routing address have at least one matching upper-level routing address, it indicates that the first network device and the second network device are in the same local area network, and the first network device and the second network device can transmit data through the upper-level device corresponding to the matching upper-level routing address. Then, a communication link between the first network device and the second network device can be established based on the matching upper-level routing address.
[0045] In the above embodiments of this application, based on the upper-level routing addresses of the upper-level devices that different network devices pass through on the corresponding routing paths, when a matching upper-level routing address is detected, i.e., different network devices are in the same local area network, a communication link between different network devices can be established based on the matching upper-level routing address, thereby shortening the communication link for different network devices to communicate, improving the response speed, and thus improving the communication quality.
[0046] In some embodiments, the step of having at least one matching parent route address among at least one first parent route address and at least one second parent route address includes:
[0047] Determine whether there is a common parent route address among at least one first parent route address and at least one second parent route address;
[0048] If the same parent route address exists, then the same parent route address is identified as the matching parent route address.
[0049] It is understandable that by comparing each of the at least one first-level upstream routing addresses with at least one second-level upstream routing address, or by comparing each of the at least one second-level upstream routing addresses with at least one first-level upstream routing address, it can be determined whether there is at least one identical upstream routing address among the at least one first-level and at least one second-level upstream routing addresses. If there is an identical upstream routing address, it is identified as the matching upstream routing address. It should be noted that if there are multiple identical upstream routing addresses, the network layers of the multiple upstream devices corresponding to these identical upstream routing addresses on the corresponding routing paths can be compared. The routing address of the upstream device at the lower network layer is taken as the matching upstream routing address, thereby shortening the communication link between the first network device and the second network device as much as possible, further improving response speed and communication quality. In this way, by directly determining whether there is a common upper-level routing address among at least one first upper-level routing address and at least one second upper-level routing address, the matching upper-level routing address can be quickly and accurately determined, further improving the communication quality.
[0050] In some embodiments, the step of establishing a communication link between a first network device and a second network device based on a matching upstream routing address includes:
[0051] Based on at least one first superior routing address and at least one second superior routing address, determine the network layer of the first network device on the corresponding routing path and the network layer of the second network device on the corresponding routing path, respectively.
[0052] A connection request is sent to a network device at a lower network layer. The connection request is used to instruct the network device at a lower network layer to establish a communication link with a network device at a higher network layer based on a matching upper-level routing address. The network device at a lower network layer refers to the device at the lower network layer among the first network device and the second network device, and the network device at a higher network layer refers to the device at the higher network layer among the first network device and the second network device.
[0053] In this context, network layer indicates the level of a network device within the network system. It can also be understood as the level of a network device on a corresponding routing path. For example, suppose a second network device is connected to router A. If router A connects to router B, and router B ultimately connects to an external Ethernet network, then the network layer of the second network device on the corresponding routing path is layer three. If router A connects to router B, router B connects to router C, and router C ultimately connects to an external Ethernet network, then the network layer of the second network device on the corresponding routing path is layer four, and so on. It can be understood that based on the number of first-level router addresses, the number of first-level devices on the corresponding path of the first network device can be determined, thus revealing the network layer of the first network device on the corresponding routing path. For example, assuming there are a total of 3 first-level upstream routing addresses, the network layer of the first network device on the corresponding routing path is level 4. Correspondingly, based on the number of second-level upstream routing addresses, we can determine how many upstream devices exist on the corresponding path of the second network device, thus determining the network layer of the second network device on the corresponding routing path. For instance, if there are a total of 2 second-level upstream routing addresses, the network layer of the second network device on the corresponding routing path is level 3. In this case, we can consider the network layer of the second network device to be higher than that of the first network device. A connection request can include the routing address corresponding to a network device with a higher network layer, so that after receiving a connection request, a network device with a lower network layer can establish a communication link with the network device with the higher network layer through the upstream device corresponding to the matching upstream routing address.
[0054] In other embodiments, network layer can also be understood as the layer at which a network device is located on the routing path between itself and the upper-level device corresponding to the matching upper-level routing address. For example, assuming that the upper-level device corresponding to the matching upper-level routing address is router B, if the first network device is connected to router A and router A is connected to router B, then the network layer of the first network device on the routing path between itself and router B is the third layer. If the second network device is connected to router B, then the network layer of the second network device on the routing path between itself and router B is the second layer. In this case, it can be determined that the network layer of the first network device is lower than the network layer of the second network device.
[0055] It should be noted that if the network layer of the first network device on the corresponding routing path is the same as that of the second network device on the corresponding routing path, the server can send a connection request carrying the routing address of the second network device to the first network device and / or send a connection request carrying the routing address of the first network device to the second network device. This allows the first and / or second network devices to establish a communication link between them based on the connection request and through the parent device corresponding to the matching parent routing address. In this way, by determining the initiator of the connection request based on the network layer of the network device on the corresponding routing path, the server controls the network devices to make targeted connections, avoiding blind connections between different devices and ensuring accurate and rapid establishment of communication links between different network devices. This further improves response speed and, consequently, communication quality.
[0056] In some embodiments, the routing address includes a network address, and the step of having at least one matching parent routing address among at least one first parent routing address and at least one second parent routing address includes:
[0057] Determine whether there exists at least one matching parent network address among at least one first parent route address and at least one second parent route address;
[0058] If a matching parent network address exists, then the matching parent network address will be determined as the matching parent routing address.
[0059] It is understandable that, when the routing address includes a network address, such as an IP address, after the server obtains at least one first-level upstream routing address corresponding to the first network device and at least one second-level upstream routing address corresponding to the second network device, it can determine whether there is a matching upstream network address among the at least one first-level upstream routing address and the at least one second-level upstream routing address. That is, it can determine whether there is a matching upstream network address among the at least one first-level upstream routing address and the at least one second-level upstream routing address. If a matching upstream network address exists, it means that the first network device and the second network device are in the same local area network (LAN), and the matching upstream network address can be identified as the matching upstream routing address. If no matching upstream network address exists, it means that the first network device and the second network device are not in the same LAN, and it can be determined that there is no matching upstream routing address among the at least one first-level upstream routing address and the at least one second-level upstream routing address. Thus, by determining whether there is a matching upper-level network address among the upper-level network addresses of at least one upper-level device that the first and second network devices pass through on their respective corresponding routing paths, it is possible to determine whether the first and second network devices are in the same local area network. This operation is convenient, can quickly and accurately determine the matching upper-level routing address, improves the comprehensiveness of detection and judgment, and further enhances communication quality.
[0060] Specifically, the method to determine whether there is at least one matching upper-level network address can be to determine whether there is at least one identical upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address. If there is an identical upper-level network address, then it is determined that there is a matching upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address, and the identical upper-level network address is determined as the matching upper-level routing address.
[0061] In some embodiments, the routing address further includes a physical address; prior to the step of determining whether there is a matching parent network address among at least one first parent routing address and at least one second parent routing address, the method further includes:
[0062] Determine whether there exists at least one matching parent physical address among at least one first parent routing address and at least one second parent routing address;
[0063] If a matching parent physical address exists, then the matching parent physical address will be determined as the matching parent routing address.
[0064] If no matching upper-level physical address exists, then the step of determining whether there is a matching upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address is performed.
[0065] It is understandable that when the routing address includes a physical address, such as a MAC address, the upstream physical address refers to the physical address of the upstream device to which the first network device and the second network device are connected. For example, if the first network device is connected to router A, and router A is connected to router B, then the upstream physical address of the first network device is the physical address of router A to which the first network device is connected. After the server obtains at least one first upstream routing address corresponding to the first network device and at least one second upstream routing address corresponding to the second network device, it can first determine whether there is a matching upstream physical address between the at least one first upstream routing address and the at least one second upstream routing address. Specifically, it determines whether there is a matching upper-level physical address among at least one first upper-level physical address and at least one second upper-level physical address. If a matching upper-level physical address exists, it means that the first network device and the second network device are in the same local area network (LAN) within the same network segment. In this case, the matching upper-level physical address can be identified as the matching upper-level routing address. If no matching upper-level physical address exists, it means that the first network device and the second network device are not in the same LAN within the same network segment. Then, it continues to determine whether there is a matching upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address to detect whether the first network device and the second network device are in the same LAN within different network segments. Thus, by first determining whether there is a matching upper-level physical address among the upper-level physical addresses of at least one upper-level device that the first and second network devices pass through on their respective routing paths, and then determining whether the first and second network devices are in the same local area network of the same network segment, this not only avoids the limitation of using BSSID to determine whether different devices are in the same local area network in the prior art, but also quickly locates the upper-level device corresponding to the matching upper-level physical address, so as to directly establish a communication link through the upper-level device. This is convenient to operate and improves the speed of communication link establishment. Furthermore, simply determining that different devices are not on the same local area network (LAN) based on the absence of a matching upstream physical address can easily lead to false positives. The absence of a matching upstream physical address only indicates that the devices are on different network segments, not necessarily that they are not on the same LAN. Therefore, to address this issue, after determining that there is no matching upstream physical address among at least one first upstream routing address and at least one second upstream routing address, we can also determine whether there is a matching upstream network address among these two addresses. If a matching upstream network address exists, then the devices are determined to be on the same LAN. This improves the comprehensiveness of the detection and judgment, reduces the probability of false positives, and further enhances communication quality.
[0066] Specifically, the method to determine whether there is at least one matching upper-level physical address can be to determine whether there is at least one identical upper-level physical address among at least one first upper-level routing address and at least one second upper-level routing address. If there is an identical upper-level physical address, then it is determined that there is a matching upper-level physical address among at least one first upper-level routing address and at least one second upper-level routing address, and the identical upper-level physical address is determined as the matching upper-level routing address.
[0067] Please see Figure 4 This application provides a device communication processing method according to an embodiment, which can be applied to... Figure 2 The first network device 3 shown includes the following communication processing method:
[0068] Step S201: Obtain at least one first upper-level routing address, the first upper-level routing address including the routing address corresponding to at least one upper-level device that the first network device passes through on the corresponding routing path.
[0069] The first network device refers to a device with network relay or forwarding functions, which may include, but is not limited to, gateways, routers, mobile terminals, or devices configured with network modules (such as Wi-Fi modules), such as human body sensors and switches. The routing address is used to represent the address that the routing expression needs to route to, including but not limited to network addresses and physical addresses. A network address is the logical address that a node on the Internet has in the network, that is, the logical address used to determine the location of a network device, which may include, but is not limited to, IP addresses, port numbers, or other protocol network addresses. A physical address is used to identify devices in the network, which may include, but is not limited to, MAC addresses (Media Access Control addresses) or other protocol physical addresses. Optionally, the routing path refers to the path that the network device needs to traverse to connect to an external network. The network layer indicates the layer at which the network device is located in the network system. Other network devices located on the same routing path as the first network device but at a higher network layer can be called superior devices. For example, suppose a first network device is connected to router A, and router A is connected to router B, and router B is ultimately connected to an external Ethernet network. Then the routing path of the first network device includes router A and router B, and router A and router B are the upstream devices that the first network device passes through on the corresponding routing path.
[0070] It should be noted that the first network device can obtain at least one first upstream routing address after successfully connecting to the network. This first upstream routing address includes the routing addresses of at least one upstream device traversed by the first network device along the corresponding routing path. The first network device then sends this first upstream routing address to the server. Alternatively, it can obtain the first upstream routing address after receiving a trigger command from the server and send it to the server. If at least one of the at least one first upstream routing address and at least one second upstream routing address matches (i.e., the target routing address), it indicates that the first network device and the second network device are within the same local area network, and a communication link can be established between them.
[0071] Step S203: If at least one first upper-level routing address includes a target routing address, then a communication link is established with the second network device based on the target routing address; the target routing address is the upper-level routing address that matches at least one first upper-level routing address and at least one second upper-level routing address corresponding to the second network device; wherein, the second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0072] It can be understood that when at least one first-level upstream routing address includes the target routing address, meaning there is a matching upstream routing address between the at least one first-level upstream routing address and the at least one second-level upstream routing address corresponding to the second network device, it indicates that the first network device and the second network device are within the same local area network. In this case, the first network device and the second network device can directly transmit data through the upstream device corresponding to the target routing address, and a communication link between the first network device and the second network device can be established based on the target routing address. It should be noted that the target routing address can be a matching upstream network address among the at least one first-level upstream routing address and the at least one second-level upstream routing address, or it can be a matching upstream physical address among the at least one first-level upstream routing address and the at least one second-level upstream routing address. Specifically, the target routing address can be the same upstream network address among the at least one first-level upstream routing address and the at least one second-level upstream routing address, or it can be the same upstream physical address among the at least one first-level upstream routing address and the at least one second-level upstream routing address.
[0073] In the above-mentioned device communication processing method, if at least one first upper-level routing address corresponding to the first network device includes a target routing address, and the target routing address is the upper-level routing address that matches at least one first upper-level routing address and at least one second upper-level routing address corresponding to the second network device, that is, when the first network device and the second network device are in the same local area network, then a communication link between the first network device and the second network device is established based on the target routing address, thereby shortening the communication link between the two, improving the response speed, and thus improving the communication quality.
[0074] In some embodiments, the step of establishing a communication link with a second network device based on a target routing address includes:
[0075] Receive a connection request sent by the server. The connection request is used to instruct the first network device to establish a communication link with the second network device based on the target routing address.
[0076] Based on the connection request, a communication link is established with the second network device through the target routing address.
[0077] The connection request may include the routing address of the second network device, such as a network address. The network layer of the first network device on the corresponding routing path may be equal to or lower than that of the second network device. Based on the connection request, the first network device establishes a communication link with the second network device through the target routing address. The first network device can send a request command to the upstream device corresponding to the target routing address to connect to the second network device. This causes the upstream device to send the same request command to the second network device. Upon the second network device's response, a communication link is established between the first and second network devices. This targeted connection method avoids blind connections between different devices, ensuring a fast and accurate establishment of the communication link, improving response speed, and further enhancing communication quality.
[0078] It should be understood that, although Figure 3-4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order in which these steps are executed, and they can be performed in other orders. Furthermore, Figure 3-4At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0079] In one embodiment, such as Figure 5 As shown, a device communication processing apparatus is provided, applied to a server, comprising: a first acquisition module and a first processing module, wherein:
[0080] The first acquisition module is used to acquire at least one first upstream routing address corresponding to the first network device and to acquire at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device that the first network device passes through on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device that the second network device passes through on the corresponding routing path.
[0081] The first processing module is configured to establish a communication link between the first network device and the second network device based on the matching upper-level routing address if at least one of the first upper-level routing addresses and at least one second upper-level routing address has at least one matching upper-level routing address.
[0082] In some embodiments, the device further includes a determination module.
[0083] The judgment module is used to determine whether there is a common parent route address among at least one first parent route address and at least one second parent route address;
[0084] The first processing module is also used to determine the same parent routing address as a matching parent routing address if the same parent routing address exists.
[0085] In some embodiments, the routing address includes a network address;
[0086] The judgment module is also used to determine whether there is a matching upstream network address between at least one first upstream routing address and at least one second upstream routing address;
[0087] The first processing module is also used to determine the matching upper-level network address as the matching upper-level routing address if a matching upper-level network address exists.
[0088] In some embodiments, the routing address also includes a physical address;
[0089] The judgment module is also used to determine whether there is a matching upper-level physical address among the at least one first upper-level routing address and the at least one second upper-level routing address before determining whether there is a matching upper-level network address among the at least one first upper-level routing address and the at least one second upper-level routing address.
[0090] The first processing module is further configured to, if a matching upper-level physical address exists, determine the matching upper-level physical address as the matching upper-level routing address; if no matching upper-level physical address exists, trigger the judgment module to determine whether there is a matching upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address.
[0091] In some embodiments, the device further includes a transmitting module.
[0092] The first processing module is specifically used to: determine the network layer of the first network device on the corresponding routing path and the network layer of the second network device on the corresponding routing path based on at least one first superior routing address and at least one second superior routing address.
[0093] The sending module is used to send connection requests to network devices at lower network layers. The connection request is used to instruct the network devices at lower network layers to establish a communication link with network devices at higher network layers based on a matching upper-level routing address. The network devices at lower network layers refer to the devices at lower network layers in the first network device and the second network device, while the network devices at higher network layers refer to the devices at higher network layers in the first network device and the second network device.
[0094] In the aforementioned device communication processing apparatus, when a matching upper-level routing address is detected among the upper-level routing addresses of at least one upper-level device that different network devices pass through on their respective corresponding routing paths, i.e., when different network devices are in the same local area network, a communication link is established between the different network devices. This shortens the communication link for communication between different network devices, improves the response speed, and thus enhances the communication quality.
[0095] Specific limitations regarding the device communication processing apparatus can be found in the limitations of the device communication processing method described above, and will not be repeated here. Each module in the aforementioned device communication processing apparatus can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0096] In one embodiment, such as Figure 6As shown, a device communication processing apparatus is provided, applied to a first network device, comprising: a second acquisition module and a second processing module, wherein:
[0097] The second acquisition module is used to acquire at least one first upper-level routing address, the first upper-level routing address including the routing address corresponding to at least one upper-level device that the first network device passes through on the corresponding routing path;
[0098] The second processing module is configured to establish a communication link with the second network device based on the target routing address if at least one first upper-level routing address includes the target routing address; the target routing address is the upper-level routing address that matches at least one first upper-level routing address and at least one second upper-level routing address corresponding to the second network device; wherein the second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0099] In some embodiments, the device further includes a receiving module.
[0100] The receiving module is used to receive connection requests sent by the server. The connection request is used to instruct the first network device to establish a communication link with the second network device based on the target routing address.
[0101] The second processing module is specifically used to: establish a communication link with the second network device based on the connection request and the target routing address.
[0102] In the aforementioned device communication processing apparatus, if at least one first upper-level routing address corresponding to the first network device includes a target routing address, and the target routing address is the upper-level routing address that matches at least one first upper-level routing address and at least one second upper-level routing address corresponding to the second network device, i.e., when the first network device and the second network device are in the same local area network, then based on the connection request sent by the server, a communication link between the first network device and the second network device is established through the target routing address, thereby shortening the communication link between the two devices. Furthermore, by establishing a communication link between the first network device and the second network device through a directed connection, blind connections between different devices are avoided, ensuring that a communication link between the first network device and the second network device can be established quickly and accurately, improving response speed, and thus enhancing communication quality.
[0103] Specific limitations regarding the device communication processing apparatus can be found in the limitations of the device communication processing method described above, and will not be repeated here. Each module in the aforementioned device communication processing apparatus can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0104] In one embodiment, a device communication processing system is provided, comprising: a server, a first network device, and a second network device;
[0105] The first network device is configured to obtain at least one first upper-level routing address and send at least one first upper-level routing address to the server. The first upper-level routing address includes the routing address corresponding to at least one upper-level device that the first network device passes through on the corresponding routing path.
[0106] The second network device is used to obtain at least one second upper-level routing address and send at least one second upper-level routing address to the server. The second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path.
[0107] A server is configured to establish a communication link between a first network device and a second network device based on the matching upper-level routing addresses, provided that at least one first upper-level routing address and at least one second upper-level routing address have at least one matching upper-level routing address.
[0108] In some embodiments, the server is further configured to determine whether there is a common upper-level routing address among at least one first upper-level routing address and at least one second upper-level routing address; if there is a common upper-level routing address, the common upper-level routing address is determined as the matching upper-level routing address.
[0109] In some embodiments, the routing address includes a network address, a server, and is also used for:
[0110] Determine whether there exists a matching parent network address between at least one first parent route address and at least one second parent route address;
[0111] If a matching parent network address exists, then the matching parent network address will be determined as the matching parent routing address.
[0112] In some embodiments, the routing address further includes a physical address; the server is also configured to determine whether there is a matching upper-level physical address among the at least one first upper-level routing address and the at least one second upper-level routing address before determining whether there is a matching upper-level network address among the at least one first upper-level routing address and the at least one second upper-level routing address.
[0113] If a matching parent physical address exists, then the matching parent physical address will be determined as the matching parent routing address.
[0114] If no matching upper-level physical address exists, then the step of determining whether there is a matching upper-level network address among at least one first upper-level routing address and at least one second upper-level routing address is performed.
[0115] In some embodiments, the server is specifically configured to: determine the network layer of the first network device and the network layer of the second network device on the corresponding routing path based on at least one first upper-level routing address and at least one second upper-level routing address; if the network layer of the first network device on the corresponding routing path is lower than the network layer of the second network device on the corresponding routing path, send a connection request to the first network device, wherein the connection request is used to instruct the network device with the lower network layer to establish a communication link with the network device with the higher network layer based on the matching upper-level routing address;
[0116] The first network device is also used to receive connection requests sent by the server, and based on the connection requests, establish a communication link with the second network device through the target routing address.
[0117] In the above embodiments of this application, when a network device detects at least one matching upper-level routing address among the upper-level routing addresses of at least one upper-level device it passes through on its corresponding routing path, i.e., when different network devices are in the same local area network, a communication link between different network devices is established, thereby shortening the communication link for communication between different network devices, improving response speed, and thus improving communication quality.
[0118] In order to gain a more systematic understanding of the device communication processing method provided in the embodiments of this application, the first network device and the second network device are used as gateways as examples, and the explanation is combined with specific scenarios.
[0119] Scene 1
[0120] See Figure 7Gateway G1 is connected to router R1.1 via R2.1 (relay or access point), and gateway G2 is connected to router R1.1 via R2.2 (relay or access point). R1.1 is connected to a public server (cloud), which can be a cloud server or a local server. G1 and G2 are on the same local area network (LAN) 192.168.1, but G1's BSSID is the MAC address of R2.1, and G2's BSSID is the MAC address of R2.2. Since the upstream router for both G1 and G2 is R1.1, it's impossible to determine that G1 and G2 are on the same LAN using their BSSIDs alone. However, the upstream router can determine that G1 and G2 are on the same LAN within the same network segment. Furthermore, after discovering each other on the LAN, G1 and G2 can directly connect via network protocols (such as TCP).
[0121] Based on the above scenario, please refer to Figure 8 The device communication processing method provided in this embodiment includes the following steps:
[0122] First, after G1 and G2 successfully connect to the network, they obtain the physical address (such as MAC address) of the upstream router connected to their respective routing paths.
[0123] Next, G1 and G2 report the physical addresses (such as MAC addresses) of the upper-level routes connected to their respective routing paths to the cloud (server);
[0124] Next, the cloud (server) determines the connection method of G1 and G2 based on the physical addresses of the upstream routes to which G1 and G2 are connected, respectively. That is, if the physical addresses of the upstream routes to which G1 and G2 are connected are the same, then it is determined that G1 and G2 can be directly connected.
[0125] Finally, the cloud (server) sends connection requests to G1 and G2 respectively, so that G1 can initiate a connection to G2 or G2 can initiate a connection to G1.
[0126] Scene 2
[0127] See Figure 9Gateway G1 is connected to router R1.1 via router R2.1, and gateway G2 is directly connected to router R1.1. R1.1 is connected to a public server (cloud), which can be a cloud server or a local server. Although G1 is in the 192.168.2 network segment and G2 is in the 192.168.1 network segment, and G1 and G2 have different BSSIDs, G2 can actually connect to G1, thus achieving mutual connectivity. This is due to the characteristics of the routers. By using the Tracert method, the routers that the device passes through to connect to the Ethernet (i.e., at least one upstream device that the device passes through on the corresponding routing path) can be found. By reporting the routing addresses corresponding to the routers passed by G1 and G2, the public server distributes them to the designated devices for targeted connections, making it easy to achieve mutual communication between G1 and G2.
[0128] Based on the above scenario, please refer to Figure 10 The device communication processing method provided in this embodiment includes the following steps:
[0129] First, after successfully connecting to the network, G1 and G2 each obtain the upper-level routing address corresponding to at least one upper-level device passed through on their respective routing paths. The routing address includes the physical address and the network address.
[0130] Next, G1 and G2 each report the routing address of at least one upstream device that they have passed through on their respective routing paths to the cloud (server);
[0131] Next, based on the upstream routing addresses of at least one upstream device that G1 and G2 have passed through on their respective routing paths, cloud determines the connection method of G1 and G2. Specifically, it first checks whether the upstream physical addresses of the upstream devices connected to G1 and G2 are the same. If they are not the same, it checks whether there is a matching upstream network address among the upstream network addresses of at least one upstream device that G1 and G2 have passed through on their respective routing paths. If there is a matching upstream network address, it checks the network layers of G1 and G2. If the network layer of G1 is lower than the network layer of G2 (i.e., the network layer of G1 is lower than the network layer of G2), then it is determined that the connection method is G1 connecting to G2.
[0132] Finally, cloud sends a connection request to G1 so that G1 can initiate a connection to G2.
[0133] Thus, in the device communication processing method provided in the above embodiments, the method of determining whether different network devices are in the same network segment and local area network by judging whether the upper-level physical addresses (such as MAC addresses) corresponding to the upper-level routers connected to different network devices match can avoid the limitation of misjudging whether different network devices are in the same local area network due to different access points (relays or APs) for accessing the upper-level routers. Furthermore, for different network devices in different network segments, the method can also be used to judge whether the upper-level network addresses corresponding to the upper-level devices that each device passes through on its respective routing path match. By using a matching upper-level network address, the limitation of determining whether different network devices are in the same local area network (LAN) solely based on the upper-level physical address corresponding to the upper-level router is avoided. That is, although different network devices are in different network segments, they are actually still in the same LAN. By reporting the network layer of each network device to the server, the server analyzes the network layer and makes targeted connections. That is, the connection request is sent to the network device with the lower network layer, so that the network device with the lower network layer initiates a connection to the other network device with the higher network layer based on the connection request, thereby establishing a communication link and avoiding blind connections between devices.
[0134] In one embodiment, an electronic device is provided, the internal structure of which can be shown as follows: Figure 11 As shown, the electronic device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a device communication processing method. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0135] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0136] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the various processes of the above-described device communication processing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may include, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0137] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0138] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A device communication processing method, applied to a server, characterized in that, The method includes: Obtain at least one first upstream routing address corresponding to the first network device, and obtain at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device traversed by the first network device on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device traversed by the second network device on the corresponding routing path. If at least one of the first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address, then a communication link between the first network device and the second network device is established based on the matching upper-level routing address. If there are multiple matching upper-level routing addresses, the network layers of the multiple upper-level devices corresponding to the multiple matching upper-level routing addresses on the corresponding routing path are compared, and the routing address of the upper-level device with the lowest network layer is determined as the matching target routing address. Based on the matching target routing address, a communication link is established between the first network device and the second network device.
2. The method according to claim 1, characterized in that, The condition that if at least one of the first superior routing addresses and at least one of the second superior routing addresses have at least one matching superior routing address includes: Determine whether there is at least one identical parent routing address among the at least one first parent routing address and the at least one second parent routing address; If the same parent routing address exists, then the same parent routing address is determined as the matching parent routing address.
3. The method according to claim 1, characterized in that, The routing address includes a network address; the condition that at least one of the at least one first superior routing address and the at least one second superior routing address has at least one matching superior routing address includes: Determine whether there is at least one matching parent network address among the at least one first parent routing address and the at least one second parent routing address; If a matching parent network address exists, then the matching parent network address is determined as the matching parent routing address.
4. The method according to claim 3, characterized in that, The routing address also includes a physical address; before determining whether there is at least one matching parent network address among the at least one first parent routing address and the at least one second parent routing address, the method further includes: Determine whether there is at least one matching upper-level physical address among the at least one first upper-level routing address and the at least one second upper-level routing address; If a matching parent physical address exists, then the matching parent physical address is determined as the matching parent routing address; If no matching upper-level physical address exists, then the step of determining whether there is at least one matching upper-level network address among the at least one first upper-level routing address and the at least one second upper-level routing address is performed.
5. The method according to any one of claims 1 to 4, characterized in that, The step of establishing a communication link between the first network device and the second network device based on the matched upper-level routing address includes: Based on the at least one first superior routing address and the at least one second superior routing address, the network layer of the first network device on the corresponding routing path and the network layer of the second network device on the corresponding routing path are determined respectively. A connection request is sent to a network device at a lower network layer. The connection request is used to instruct the network device at a lower network layer to establish a communication link with a network device at a higher network layer based on the matching upper-level routing address. The network device at a lower network layer refers to the device at a lower network layer among the first network device and the second network device, and the network device at a higher network layer refers to the device at a higher network layer among the first network device and the second network device.
6. A device communication processing apparatus, applied to a server, characterized in that, The device includes: The first acquisition module is used to acquire at least one first upstream routing address corresponding to the first network device and to acquire at least one second upstream routing address corresponding to the second network device; the first upstream routing address includes the routing address corresponding to at least one upstream device traversed by the first network device on the corresponding routing path; the second upstream routing address includes the routing address corresponding to at least one upstream device traversed by the second network device on the corresponding routing path. The first processing module is configured to establish a communication link between the first network device and the second network device based on the matching upper-level routing address if at least one of the first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address. The first processing module is further configured to, if there are multiple matching upper-level routing addresses, compare the network layers of the multiple upper-level devices corresponding to the multiple matching upper-level routing addresses on the corresponding routing path, determine the routing address of the upper-level device with the lowest network layer as the matching target routing address, and establish a communication link between the first network device and the second network device based on the matching target routing address.
7. A device communication processing system, characterized in that, include: Server, first network device, and second network device; The first network device is configured to obtain at least one first upper-level routing address and send the at least one first upper-level routing address to the server. The first upper-level routing address includes the routing address corresponding to at least one upper-level device that the first network device passes through on the corresponding routing path. The second network device is configured to obtain at least one second upper-level routing address and send the at least one second upper-level routing address to the server. The second upper-level routing address includes the routing address corresponding to at least one upper-level device that the second network device passes through on the corresponding routing path. The server is configured to establish a communication link between the first network device and the second network device based on the matching upper-level routing address if at least one of the at least first upper-level routing addresses and the at least one second upper-level routing address has at least one matching upper-level routing address. The server is further configured to, if there are multiple matching upper-level routing addresses, compare the network layers of the multiple upper-level devices corresponding to the multiple matching upper-level routing addresses on the corresponding routing path, determine the routing address of the upper-level device with the lowest network layer as the matching target routing address, and establish a communication link between the first network device and the second network device based on the matching target routing address.
8. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein the computer program, when executed by the processor, implements the device communication processing method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the device communication processing method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Configuration method of networking device, and gateway
CN107086934A
Control method and device and electronic equipment
CN113050901A