CN108200567B - Device discovery method and device - Google Patents

Device discovery method and device Download PDF

Info

Publication number
CN108200567B
CN108200567B CN201810048839.0A CN201810048839A CN108200567B CN 108200567 B CN108200567 B CN 108200567B CN 201810048839 A CN201810048839 A CN 201810048839A CN 108200567 B CN108200567 B CN 108200567B
Authority
CN
China
Prior art keywords
equipment
subnet
address
search request
devices
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810048839.0A
Other languages
Chinese (zh)
Other versions
CN108200567A (en
Inventor
陈梁
徐杨波
袁文君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN201810048839.0A priority Critical patent/CN108200567B/en
Publication of CN108200567A publication Critical patent/CN108200567A/en
Application granted granted Critical
Publication of CN108200567B publication Critical patent/CN108200567B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/005Discovery of network devices, e.g. terminals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/695Types of network addresses using masks or ranges of addresses

Abstract

The embodiment of the invention provides a device discovery method and device, which are used for solving the technical problem of low efficiency of communication equipment during device discovery in the prior art. The method comprises the following steps: determining a first Internet Protocol (IP) address in a website range configured by a user through random scanning, and sending a device search request by taking the first IP address as a destination address; the preset website range corresponds to at least two subnets, and the equipment search request is used for searching and discovering terminal equipment in the network; if feedback information sent by the terminal equipment corresponding to the first IP address according to the equipment searching request is received, determining a first subnet of the at least two subnets where the terminal equipment is located according to the feedback information; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located; and acquiring the equipment information of all the terminal equipment in the first subnet.

Description

Device discovery method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a device discovery method and device.
Background
At present, in an internet of things with a large scale, the sub-networks are often divided and the networks are often layered according to the functions of areas or sensing nodes. The networks are isolated by the division of the subnets and the layering of the networks to improve the overall throughput and overall reliability of the network.
In a network without sub-networks being divided, a central management node can complete the discovery of all sensor nodes of the network through simple broadcast (multicast), but this is not applicable in a sub-network-divided network, and broadcast (multicast) messages are shielded by sub-network routers so that sensor nodes in other sub-networks cannot be discovered. Although some high-end routers support cross-segment forwarding of multicast, they are rarely used in large-scale, low-cost networks such as the internet of things.
To achieve this node discovery under a subnet, the existing technologies are mainly classified into two categories:
the central management node is in a traversal type: that is, when all nodes are found, the central management node performs traversal unicast scanning on all possible Internet Protocol addresses (IP addresses) in the network. The method needs to send a large number of devices to search for unicast packets in a specified network segment when device discovery is carried out, which can cause network congestion, and is a great test for the performance of a central node when the number of devices is large.
Fixed proxy: i.e. each subnet is individually provided with a device node dedicated to discovering devices under the subnet. The central management node needs to manually input the agent nodes under all the subnets in advance. When equipment needs to be discovered, the central management node initiates a request to each agent node; after receiving the request, the agent node discovers all devices in the subnet by adopting the aforementioned broadcast (multicast) mode, and then forwards all device information of the subnet to the central node. However, in this method, if the fixed agent goes down, the devices in the entire subnet are all managed separately.
Therefore, the communication equipment in the prior art has low efficiency and poor stability when equipment discovery is carried out.
Disclosure of Invention
The embodiment of the invention provides a device discovery method and device, which are used for solving the technical problem of low efficiency of communication equipment during device discovery in the prior art.
In a first aspect, an embodiment of the present invention provides a device discovery method, including:
determining a first Internet Protocol (IP) address in a website range configured by a user through random scanning, and sending a device search request by taking the first IP address as a destination address; the preset website range corresponds to at least two subnets, and the equipment search request is used for searching and discovering terminal equipment in the network;
if feedback information sent by the terminal equipment corresponding to the first IP address according to the equipment searching request is received, determining a first subnet of the at least two subnets where the terminal equipment is located according to the feedback information; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located;
and acquiring the equipment information of all the terminal equipment in the first subnet.
Optionally, the obtaining device information of all terminal devices in the first subnet includes:
receiving the device information of all the terminal devices found in the first subnet by the terminal device according to the device search request; or;
and receiving own equipment information sent by other terminal equipment except the terminal equipment in the first subnet according to the equipment search request forwarded by the terminal equipment.
Optionally, after determining, according to the feedback information, a first subnet of the at least two subnets where the terminal device is located, the method further includes:
determining a first network segment corresponding to the first subnet in the website range configured by the user;
randomly scanning and determining a second IP address which is out of the first network segment in the website range configured by the user;
and sending the equipment search request by taking the second IP address as a destination address to acquire equipment information of all equipment in a second subnet, wherein the network segment of the second subnet is the network segment where the second IP address is located.
Optionally, after obtaining the device information of all the devices in the first subnet, the method further includes:
determining the performance parameters of each device in all the devices according to the device information, wherein the performance parameters are used for representing the performance conditions of the corresponding devices;
arranging all the devices according to the sequence of the performance represented by the performance parameters of each device from top to bottom to obtain the arrangement sequence of all the devices;
determining a preset number of target devices positioned at the front in the arrangement sequence;
and setting the preset number of target devices as candidate agent devices of the first subnet.
Optionally, after the preset number of target devices are set as candidate proxy devices of the first subnet, the method further includes:
when determining that a new device search request for the website address range exists, sending the new device search request to a proxy device of the candidate proxy devices in the first subnet;
and determining that feedback information sent by the agent equipment aiming at the new equipment search request is not received within a preset time length, and selecting new agent equipment from the candidate agent equipment to send the new equipment search request.
In a second aspect, an embodiment of the present invention provides a device discovery method, applied to a terminal device, including:
receiving an equipment search request sent by a central management node; the destination address carried in the device search request is an IP address determined by randomly scanning a website range configured by a user by the central management node;
determining whether the device has a device discovery function;
if the terminal equipment is determined to have the equipment discovery function, searching all equipment in a current subnet according to the equipment search request, wherein the current subnet is the subnet in which the terminal equipment is located;
and acquiring the equipment information of all the equipment, and sending the equipment information of all the equipment to the central management node.
Optionally, after determining whether the terminal device has a device discovery function, the method further includes:
if the device does not have the device discovery function, forwarding the device search request in the current subnet; wherein, the forwarded device search request carries the IP address of the central management node.
In a third aspect, an embodiment of the present invention provides a server, including:
the device comprises a sending module, a searching module and a searching module, wherein the sending module is used for determining a first Internet Protocol (IP) address in a website range configured by a user through random scanning and sending a device searching request by taking the first IP address as a destination address; the preset website range corresponds to at least two subnets, and the equipment search request is used for searching and discovering terminal equipment in the network;
a first determining module, configured to determine, according to feedback information sent by the terminal device corresponding to the first IP address according to the device search request, a first subnet of the at least two subnets where the terminal device is located, if the feedback information is received; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located;
and the acquisition module is used for acquiring the equipment information of all the terminal equipment in the first subnet.
Optionally, the obtaining module is configured to:
receiving the device information of all the terminal devices found in the first subnet by the terminal device according to the device search request; or;
and receiving own equipment information sent by other terminal equipment except the terminal equipment in the first subnet according to the equipment search request forwarded by the terminal equipment.
Optionally, the server further includes:
a second determining module, configured to determine, after determining a first subnet of the at least two subnets where the terminal device is located according to the feedback information, a first network segment corresponding to the first subnet in the website range configured by the user;
the sending module is used for randomly scanning and determining a second IP address which is positioned outside the first network segment in the website range configured by the user, sending the equipment search request by taking the second IP address as a destination address, and acquiring equipment information of all equipment positioned in a second subnet, wherein the network segment of the second subnet is the network segment where the second IP address is positioned.
Optionally, the server further includes:
a third determining module, configured to determine, after acquiring device information of all devices in the first subnet, a performance parameter of each device in the all devices according to the device information, where the performance parameter is used to characterize a performance condition of a corresponding device;
the sorting module is used for sorting all the equipment according to the sequence of the performance represented by the performance parameter of each equipment from top to bottom to obtain the sorting sequence of all the equipment;
a setting module, configured to determine a preset number of target devices located at a top position in the ranking order, and set the preset number of target devices as candidate proxy devices of the first subnet.
Optionally, the sending module is further configured to: after the preset number of target devices are set as candidate proxy devices of the first subnet, when determining that a new device search request aiming at the website address range exists, sending the new device search request to a proxy device of the candidate proxy devices in the first subnet; and determining that feedback information sent by the agent equipment aiming at the new equipment search request is not received within a preset time length, and selecting new agent equipment from the candidate agent equipment to send the new equipment search request.
In a fourth aspect, an embodiment of the present invention provides a terminal device, including:
the receiving module is used for receiving an equipment searching request sent by the central management node; the destination address carried in the device search request is an IP address determined by randomly scanning a website range configured by a user by the central management node;
the device comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining whether the device has a device discovery function or not;
the searching module is used for searching all devices in a current subnet according to the device searching request if the device discovering function is determined to be possessed by the searching module, wherein the current subnet is the subnet where the terminal device is located;
and the operation module is used for acquiring the equipment information of all the equipment and sending the equipment information of all the equipment to the central management node.
Optionally, the operation module is further configured to: if the terminal is determined not to have the device discovery function, forwarding the device search request in the current subnet; wherein, the forwarded device search request carries the IP address of the central management node.
In a fifth aspect, an embodiment of the present invention provides a computer apparatus, which includes a processor, and the processor is configured to implement the method according to the first aspect and the second aspect when executing a computer program stored in a memory.
In a sixth aspect, the present invention provides a computer-readable storage medium storing computer instructions, which when executed on a computer, cause the computer to perform the method according to the first and second aspects.
In the embodiment of the invention, the first IP address is selected from the website range configured by the user in a random scanning mode, and the device search request is sent by taking the first IP address as the destination address, so that when feedback information sent by a terminal corresponding to the first IP address according to the device search request is received, the first subnet where the terminal is located can be determined according to the feedback information as the feedback information can indicate the network segment of the subnet where the terminal is located, and then the device information of all terminals in the first subnet is obtained.
Meanwhile, the device search request is sent to the terminal in the subnet in a random scanning mode, a fixed proxy node does not need to be arranged in the subnet, and the cost is reduced.
Drawings
Fig. 1 is a first flowchart of a device discovery method according to an embodiment of the present invention;
fig. 2 is a first flowchart of a central management node discovery apparatus according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating changes in network segments to be scanned of a central management node according to an embodiment of the present invention;
FIG. 4 is a second flowchart of a central management node discovery apparatus according to an embodiment of the present invention;
fig. 5 is a flowchart of a device discovery method according to an embodiment of the present invention;
FIG. 6 is a block diagram of a server in an embodiment of the invention;
fig. 7 is a block diagram of a terminal device in the embodiment of the present invention;
FIG. 8 is a block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
First, some terms in the embodiments of the present invention are explained.
1) A central management node, which acts as a manager of the devices in the overall network, e.g. a management server. It first needs to discover all the devices in the network. It therefore contains a discovery module among other business functions. The discovery unit mainly comprises two units: 1. a User Datagram Protocol (UDP) unicast discovery module; 2. a Transmission Control Protocol (TCP) strong proxy information summarization module.
2) The terminal device may be a device having a wireless communication function. The terminal device may connect and communicate with the server through a wireless communication function, for example, to receive a device search request sent by the server (e.g., a central management node server) or to send a device search request to the server. The terminal device may communicate with a core Network via a Radio Access Network (RAN). The Terminal Device may include a User Equipment (UE), a wireless Terminal Device, a Mobile Terminal Device, a Subscriber Unit (Subscriber Unit), a Subscriber Station (Subscriber Station), a Mobile Station (Mobile), a Remote Station (Remote Station), an Access Point (AP), a Remote Terminal Device (Remote Terminal), an Access Terminal Device (Access Terminal), a User Terminal Device (User Terminal), a User Agent (User Agent), or a User Equipment (User Device), etc. For example, mobile phones (or so-called "cellular" phones), computers with mobile terminal equipment, portable, pocket, hand-held, computer-included or vehicle-mounted mobile devices, smart wearable devices, and the like may be included. For example, Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), smart watches, smart helmets, smart glasses, smart bracelets, and the like. Also included are constrained devices, such as devices that consume less power, or devices that have limited storage capabilities, or devices that have limited computing capabilities, etc. Including, for example, bar codes, Radio Frequency Identification (RFID), sensors, Global Positioning Systems (GPS), laser scanners, and other information sensing devices.
3) The weak node may be a terminal device with poor performance, which can only be a discoveree and cannot be the discoverer. Therefore, the function of collecting information of all devices in the network segment cannot be completed. However, the number of nodes with weaker performance in the internet of things is larger, so that in order to improve the discovery efficiency of the cross-network segment, a discovery request forwarding function is added for the nodes. When the device receives the search request of the central management node, the function not only replies the device information of the device, but also broadcasts and forwards the request to all devices in the local area network, and after receiving the request, other devices directly reply the request to the central management node.
4) The strong node can be a terminal device with stronger performance, and the strong node also has a device discovery function in the local area network. Therefore, when receiving the UDP unicast discovery request of the central management node, the network segment not only immediately replies to the central management node, but also starts device discovery of the network segment, summarizes all device information of the network segment after discovery is completed, and then sends the device information to the central management node through TCP.
Preferred embodiments of the present invention will be described below with reference to the accompanying drawings.
Example one
The embodiment of the present invention provides an apparatus and method, which can be applied to the central management node, such as a server. As shown in fig. 1, the inventive method of the apparatus can be described as follows:
s11: determining a first IP address in an address range configured by a user through random scanning, and sending a device search request by taking the first IP address as a destination address; the preset website range corresponds to at least two subnets, and the device search request is used for searching and discovering devices in the network.
In the embodiment of the invention, the user can set which address range is provided with the terminal equipment in the central management node in advance.
When the central management node needs to discover the device, the IP addresses are selected to be dispersed as much as possible in the random scanning process through randomly scanning the address range configured by the user, so that the scanned addresses can randomly cover all the subnets.
Through random scanning, the central management node can randomly select a first IP address in an address range, and sends an equipment search request with the first IP address as a destination address, wherein the equipment search request carries a source IP address of the central management node.
Of course, the device search request may also carry other information, such as the requested service, the type information of the service, and the like.
S12: if feedback information sent by the terminal equipment corresponding to the first IP address according to the equipment searching request is received, determining a first subnet of at least two subnets where the terminal equipment is located according to the feedback information; the feedback information is used for indicating the network segment of the subnet where the terminal device is located.
In the embodiment of the present invention, the feedback information replied by the terminal device carries the IP address and the subnet mask of the terminal device, or the feedback information may directly include the network segment of the subnet (e.g., local area network) where the device is located. Of course, the feedback information may also include device information related to the terminal device, such as performance parameters characterizing performance.
If the central management node receives the feedback information, it indicates that the terminal device using the first IP address exists, and at this time, the network segment of the first subnet where the terminal device is located may be determined according to the feedback information of the terminal device.
For example, the central management node calculates the network segment where the terminal device is located according to the IP address and the subnet mask carried in the feedback information, or, if the central management node carries the network segment of the local area network where the terminal device is located, the network segment can be directly obtained.
In practical applications, after S11, the central management node may continue to perform scanning and sending device search requests within the range of the web address, that is, may select corresponding IP address sending requests by scanning in a concurrent manner, so as to improve the discovery efficiency, and when performing concurrent scanning, the addresses selected by random scanning may be dispersed as much as possible.
For example, after sending the device search request with the first IP address as the destination address, the central management node may randomly scan out the second IP address (the interval from the first IP address may be larger), and send the device search request to the second IP address.
Of course, within a certain time duration after the central management node sends the device search request to the second IP address, if the feedback information of the terminal device corresponding to the first IP address is not received, it indicates that the IP address may be an invalid IP address, that is, there is no terminal device using the IP address.
In the embodiment of the invention, after the central management node determines the network segment of the first subnet where the terminal device corresponding to the first IP address is located according to the feedback information, the network segment can be deleted from the random scanning address, and the subsequent central management node can not scan the network segment.
For example, if feedback information sent by a terminal corresponding to a first IP address is received at a certain time, and it is determined that the terminal is in a first network segment according to the feedback information, when subsequent random scanning is performed, the first network segment may be deleted from the random scanning address and scanned, for example, a second IP address outside the first network segment in a scanning selection website range is scanned, and the device search request is sent by using the second IP address as a destination address, so as to search devices in each subnet corresponding to a network range set by a user.
S13: and acquiring the equipment information of all the terminal equipment in the first subnet.
In the embodiment of the present invention, after determining the first subnet where the terminal device is located, the central management node may further obtain device information of all terminal devices in the first subnet. According to the difference of the performance of the terminal device corresponding to the first IP address, the following two methods can be used to determine the device information sending method:
the first method is as follows: the terminal device corresponding to the first IP address has a device discovery function, that is, the terminal device is a strong node, and the device information is obtained by searching and acquiring the device information of all terminal devices in the first subnet by using the device discovery function of the terminal device corresponding to the first IP address after receiving the device search request, and sending the acquired device information of all terminal devices to the central management node.
In this way, if the terminal device corresponding to the IP address selected by the central management node through random scanning is a strong node in the subnet, the strong node may be used as a temporary proxy node, and other devices in the subnet that meet the search request are found based on the device search request. Therefore, the central management node receives the device information of all the terminal devices found by the terminal device in the first subnet according to the device search request.
For example, a terminal device (strong node) having a device discovery function in a local area network discovers all devices in a first subnet (local area network) in a broadcast (multicast) manner, and after all devices in the local area network are searched, the strong node aggregates device information in the first subnet and reliably transmits the aggregated device information to a central management node server in a protocol manner such as TCP.
The second method comprises the following steps: the terminal device corresponding to the first IP address does not have a device discovery function, that is, the terminal device is a weak node, and the device information may be device information of itself sent by each of the other terminals in the first subnet except the terminal device.
That is to say, in this manner, after receiving the device search request, the weak node forwards the device search request to other devices through broadcast/multicast in the local area network, and at the same time, indicates the IP address of the original initiator of the request, that is, the IP address of the central management node, in the data packet, after receiving the device search request, the other devices in the local area network can directly reply their own device information to the central management node according to the source IP address, and the device information may also include the IP address, the subnet mask, and the performance parameter representing performance, and so on.
Therefore, in the embodiment of the present invention, since the terminal device selected by the random scanning will forward the request in the corresponding subnet (lan) or directly complete the search in the lan, and collect the device information to the search initiator, compared with a simple random scanning manner, the device actually searched by the random scanning is greatly reduced, and the search speed is greatly increased, and meanwhile, since the number of the self-scanning is reduced and part of the devices collect the information in the lan and then directly transmit the information to the search initiator, the pressure of the search initiator, such as the network bandwidth pressure, the CPU pressure, etc., is greatly reduced.
Meanwhile, in the embodiment of the invention, a fixed and independent proxy node is not needed, so that compared with a fixed proxy mode, the invention reduces the capital cost (one proxy server is reduced for each subnet), the labor cost (the fixed proxy server needs to configure the IP address of the central management node, or the central management node needs to configure the IP address of each fixed proxy server).
Further, since the agent is also a device, there is also a possibility of failure, in the prior art, in the fixed agent mode, the subnet in which the agent is down cannot interact with the central management node. In the embodiment of the invention, any equipment can become a temporary agent, and the terminal equipment with strong performance can become a strong agent with a search function, so that the search of the equipment in the local area network can be directly completed; the performance is poor, the terminal device which does not have the searching function can become a weak proxy, and the request can be directly forwarded in the local area network (no performance pressure is caused to the proxy device), so that the reliability of the whole network is greatly improved.
After S13, the central management node may further determine, according to the device information and the terminal device, a performance parameter of each device in all the devices in the first subnet, where the performance parameter may be used to characterize performance of the corresponding device.
Furthermore, the central management device may rank all the devices according to a sequence from top to bottom of the performance represented by the performance parameter of each device, obtain a ranking order of all the devices, determine a preset number of target devices located at the top in the ranking order, and set the preset number of target devices as candidate proxy devices of the first subnet. For example, the first N devices in the ranking order are selected as candidate proxy devices, N is a positive integer, for example, N may take 2, 3 or other values, and the value of N may be set according to actual situations and requirements.
Further, if a new device search request exists, when the central management node randomly scans the website range, the new device search request may be sent to a proxy device of the candidate proxy devices in the first subnet, for example, the priority is set according to the performance, and the candidate device with the highest priority is selected to send the request. This skips the time consuming random scanning process of the first discovery and allows all devices in each subnet to be discovered at once. Therefore, the strong node obtained by the previous equipment search can accelerate the equipment search speed.
Of course, if it is determined that the feedback information sent by the selected proxy device for the new device search request is not received within the preset time period, it indicates that the proxy device may be out of order or down, and at this time, the new proxy device may be selected from the candidate proxy devices to send the new device search request, so as to discover the device satisfying the request in the first subnet. The reselected proxy device may be a proxy device determined according to priority, and the higher the priority is, the higher the performance is, the higher the priority is, the proxy device with high performance is preferentially selected.
Therefore, in the embodiment of the present invention, after the first search discovery is completed, the central management node already knows which device nodes exist under the first subnet. The central management node can select N devices for storage according to the performance of the central management node, and then directly initiates searching to the stored high-performance equipment of each network segment when searching each time, and then feeds back or forwards the search request in the local area network after the searching in the local area network is completed. Therefore, the random scanning process in the first discovery process is skipped, all the devices in each subnet can be discovered immediately, the scanning time is saved, and the searching efficiency is improved.
Furthermore, since each network segment records N devices, it is equivalent to have N-1 backup agents, and even if the N recorded devices are all failed, the central management node can discover all devices under the subnet again by the foregoing random scanning method, so that the reliability is greatly improved compared with the common fixed agent mode.
In the following, an application scenario of the device discovery method in the embodiment of the present invention is further described by way of examples.
Scene 1: as shown in fig. 2, it illustrates a flowchart of device discovery performed by a central management node in a random scanning manner. In this illustration, the central management node needs to manage two sub-networks, each sub-network comprising at least two devices, i.e. one device with device discovery function (strong node) and one terminal device with weaker performance (weak node) which may not have device discovery function.
Then, the searching process of the central management node is as follows:
the central management node starts to randomly scan the address range configured by the user. When a strong device (strong node 2) in the subnet 2 is hit, the device immediately replies its own information, and the device includes the IP and subnet mask of the device or directly includes the network segment of the local area network where the device is located. It should be noted that "hit" here means that the IP address selected by random scanning corresponds to the corresponding terminal, and the word appearing later herein expresses this meaning.
After receiving the reply information of the strong node 2, the central management node calculates (or acquires) the network segment where the device is located, and deletes the network segment from the random scanning address. Subsequent central management nodes are not scanning for the network segment.
Meanwhile, the strong device corresponding to the strong node 2 in the subnet 2 starts to discover all devices in the local area network in a broadcast (multicast) manner, and after all devices in the local area network are searched, the device collects device information in the local area network and reliably transmits the device information to the central management node in a TCP (transmission control protocol) manner.
When strong equipment in the subnet 2 carries out local area network search, the central management node also carries out random scanning in the rest other network segments.
At some point, the central management node randomly scans for weak devices 1 in the subnet 1. At this time, if the device 1 immediately replies its own device information, this information, like the strong device information, must include the IP and subnet mask of the device, or directly include the lan segment where the device is located, and may even include related performance parameters.
After receiving the reply information of the weak device 1, the central management node calculates (acquires) the network segment where the device is located, and deletes the network segment from the random scanning address. Subsequent central management nodes are not scanning for the network segment.
Meanwhile, since the weak device in the subnet 1 does not have the capability of searching for other devices, it directly forwards the device search request of the central management node to all other devices in the local area network in a broadcast (multicast) manner, and indicates the IP address of the original initiator of the request, i.e. the IP address of the central management node, in the data packet.
After receiving the forwarding request, the other devices in the local area network of the subnet 1 directly reply the device information of the other devices to the central management node. Meanwhile, in order to reduce the instantaneous pressure of the central management node, the devices can reply at random time within a certain time, so that the central management node can stably operate when being accessed to a large number of devices.
Meanwhile, if other network segments are not covered, the central management node continues the random search similar to the previous random search until the network segment to be searched specified by the user is completely covered.
By this point, the central management node has completed a search and discovered all devices under multiple subnets. As shown in fig. 3, it is a network segment change diagram to be scanned of a central management node.
Scene 2:
in this scenario, the central management node may perform a second random discovery subsequently, and through the first random discovery, the central management node knows that there is a candidate agent device in the subnet 2. With reference to fig. 4, the process of the central management node in the subsequent device discovery is as follows:
the central management node selects one device from the candidate agent devices of each sub-network, for example, the device with the best performance can be selected, and a search request is initiated to the device, and meanwhile, a timeout timer is started.
After receiving the request, the strong device 1 in the subnet 1 starts the local area network search in the subnet 1 and feeds back the search result to the central management node.
The strong device 2 in the sub-network 2 is down before receiving the request, so it will not give any response to the central management node, and will not only search for any local area network.
After the timer started in the first step by the central management node is overtime, the central management node finds that the strong device 2 of the subnet 2 has no response, and therefore the weak device 2 is reselected to initiate a search request.
The weak device 2 replies immediately after receiving the request and forwards the search request carrying the original request address to the local area network.
If all the devices stored in the sub-networks are down, the central node restarts the process similar to the first search to find the devices in the other network segments.
Example two
The embodiment of the invention provides a device discovery method, which is applied to terminal devices, wherein the terminal devices can be devices in a local area network and can communicate with a central management node. As shown in fig. 5, the method may be described as follows:
s21: receiving an equipment search request sent by a central management node; the destination address carried in the device search request is an IP address determined by randomly scanning a website range configured by a user by the central management node.
S22: determining whether the device has a device discovery function;
s23: if the device discovery function is determined to be possessed, searching all terminal devices in the current subnet according to the device search request, wherein the current subnet is the subnet where the terminal devices are located;
s24: and acquiring the equipment information of all the terminal equipment, and sending the equipment information of all the terminal equipment to the central management node.
In the embodiment of the invention, after the IP address corresponding to the terminal equipment is selected by the central management node in a random scanning mode, the IP address receives the equipment search request of the central management node, so that whether the IP address has an equipment discovery function can be judged, and a corresponding processing mode is determined according to the judgment result.
The first method is as follows: and if the judgment result shows that the terminal equipment has the equipment discovery function, searching all terminal equipment in the current subnet according to the equipment search request, wherein the current subnet is the subnet where the terminal equipment is located, acquiring the equipment information of all the equipment, and sending the equipment information of all the equipment to the central management node, for example, carrying out reliable transmission according to a TCP (transmission control protocol).
The second method comprises the following steps: and the judgment result shows that the terminal equipment does not have the equipment discovery function, the equipment search request is forwarded in the current subnet, and the forwarded equipment search request carries the IP address of the central management node.
That is, when the terminal device itself does not have the capability of searching for other devices, the device search request of the central management node may be directly forwarded to all other devices in the local area network (current subnet) in a broadcast (or multicast) manner, and the IP address of the original initiator of the request, that is, the IP address of the central management node, is indicated in the data packet.
After receiving the forwarding request, other devices in the current subnet can directly reply the device information to the central management node according to the IP address of the central management node. In practical applications, in order to reduce the instantaneous pressure of the central management node, the devices reply at random time within a certain time, so as to ensure that the central management node can stably operate when accessing a large number of devices.
After S21, the end device may also immediately reply with its own information including IP address and subnet mask to the central management node, or directly include the network segment of the current subnet, and may even include performance parameters, etc. Therefore, the central management node determines the network segment where the terminal is arranged based on the replied information and excludes the scanning of the network segment in the next scanning.
For the relevant application process of the terminal device in the device discovery process of the central management node, reference may be made to fig. 2 to fig. 3 and the description thereof, which are not repeated herein.
EXAMPLE III
Embodiments of the present invention provide a server that may be used to perform the method shown in fig. 1, and that may act as a central management node. As shown in fig. 6, the server includes a sending module 10, a first determining module 20, and an obtaining module 30.
The sending module 10 may be configured to determine a first internet protocol IP address in a website range configured by a user through random scanning, and send a device search request with the first IP address as a destination address; the preset website range corresponds to at least two subnets, and the equipment search request is used for searching and discovering terminal equipment in the network;
the first determining module 20 may be configured to, if receiving feedback information sent by the terminal device corresponding to the first IP address according to the device search request, determine, according to the feedback information, a first subnet of the at least two subnets where the terminal device is located; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located;
the obtaining module 30 may be configured to obtain device information of all terminal devices in the first subnet.
Optionally, the obtaining module 30 may be configured to:
receiving the device information of all the terminal devices found in the first subnet by the terminal device according to the device search request; or;
and receiving own equipment information sent by other terminal equipment except the terminal equipment in the first subnet according to the equipment search request forwarded by the terminal equipment.
Optionally, the server further includes:
a second determining module, configured to determine, after determining a first subnet of the at least two subnets where the terminal device is located according to the feedback information, a first network segment corresponding to the first subnet in the website range configured by the user;
the sending module 10 may be configured to randomly scan and determine a second IP address, which is located outside the first network segment, in the website range configured by the user, and send the device search request by using the second IP address as a destination address to obtain device information of all devices located in a second subnet, where the network segment of the second subnet is a network segment where the second IP address is located.
Optionally, the server further includes:
a third determining module, configured to determine, after acquiring device information of all devices in the first subnet, a performance parameter of each device in the all devices according to the device information, where the performance parameter is used to characterize a performance condition of a corresponding device;
the sorting module is used for sorting all the equipment according to the sequence of the performance represented by the performance parameter of each equipment from top to bottom to obtain the sorting sequence of all the equipment;
a setting module, configured to determine a preset number of target devices located at a top position in the ranking order, and set the preset number of target devices as candidate proxy devices of the first subnet.
Optionally, the sending module 10 is further configured to: after the preset number of target devices are set as candidate proxy devices of the first subnet, when determining that a new device search request aiming at the website address range exists, sending the new device search request to a proxy device of the candidate proxy devices in the first subnet; and determining that feedback information sent by the agent equipment aiming at the new equipment search request is not received within a preset time length, and selecting new agent equipment from the candidate agent equipment to send the new equipment search request.
Example four
The embodiment of the invention provides a terminal device which can be used for executing the method shown in fig. 5, and the server can be used as a central management node. As shown in fig. 7, the terminal device includes a receiving module 40, a second determining module 50, a searching module 60, and an operating module 70.
The receiving module 40 is configured to receive an apparatus search request sent by a central management node; and the destination address carried in the equipment search request is an IP address determined by randomly scanning a website range configured by a user by the central management node.
The determination module 50 is used to determine whether it has a device discovery function.
The searching module 60 may be configured to search all devices in a current subnet according to the device search request if it is determined that the device discovery function is available, where the current subnet is a subnet in which the terminal device is located;
the operation module 70 may be configured to obtain the device information of all the devices, and send the device information of all the devices to the central management node.
Optionally, the operation module 70 may further be configured to: if the terminal is determined not to have the device discovery function, forwarding the device search request in the current subnet; wherein, the forwarded device search request carries the IP address of the central management node.
EXAMPLE five
In an embodiment of the present invention, a computer apparatus is further provided, which has a structure as shown in fig. 8, and includes a processor 31 and a memory 32, where the processor 31 is configured to implement the steps of the data processing method provided in the first embodiment of the present invention when executing the computer program stored in the memory 32.
Optionally, the processor 31 may specifically be a central processing unit, an Application Specific Integrated Circuit (ASIC), one or more Integrated circuits for controlling program execution, a hardware Circuit developed by using a Field Programmable Gate Array (FPGA), or a baseband processor.
Optionally, the processor 31 may include at least one processing core.
Optionally, the electronic device further includes a Memory 32, and the Memory 32 may include a Read Only Memory (ROM), a Random Access Memory (RAM), and a disk Memory. The memory 32 is used for storing data required by the processor 31 in operation. The number of the memory 32 is one or more.
EXAMPLE six
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the steps of the data processing method provided in the embodiment of the present invention may be implemented.
In the embodiments of the present invention, it should be understood that the disclosed data processing method and data processing apparatus may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical or other form.
The functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be an independent physical module.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the technical solutions of the embodiments of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device, such as a personal computer, a server, or a network device, or a Processor (Processor), to execute all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a Universal Serial Bus flash drive (USB), a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, and an optical disk.
The above embodiments are only used to describe the technical solutions of the present invention in detail, but the above embodiments are only used to help understanding the method of the embodiments of the present invention, and should not be construed as limiting the embodiments of the present invention. Variations or substitutions that may be readily apparent to one skilled in the art are intended to be included within the scope of the embodiments of the present invention.

Claims (11)

1. A device discovery method, comprising:
determining a first Internet Protocol (IP) address in a website range configured by a user through random scanning, and sending a device search request by taking the first IP address as a destination address; the device searching request is used for searching and discovering terminal devices in the network;
if feedback information sent by the terminal equipment corresponding to the first IP address according to the equipment searching request is received, determining a first subnet of the at least two subnets where the terminal equipment is located according to the feedback information; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located;
when the terminal equipment is a strong node, receiving equipment information of all terminal equipment found in the first subnet by the terminal equipment according to the equipment search request;
and when the terminal equipment is a weak node, receiving own equipment information sent by other terminal equipment except the terminal equipment in the first subnet according to the equipment search request forwarded by the terminal equipment.
2. The method of claim 1, wherein after determining a first subnet of the at least two subnets in which the terminal device is located based on the feedback information, the method further comprises:
determining a first network segment corresponding to the first subnet in the website range configured by the user;
randomly scanning and determining a second IP address which is out of the first network segment in the website range configured by the user;
and sending the equipment search request by taking the second IP address as a destination address to acquire equipment information of all equipment in a second subnet, wherein the network segment of the second subnet is the network segment where the second IP address is located.
3. The method of claim 1, wherein after obtaining device information for all devices within the first subnet, the method further comprises:
determining the performance parameters of each device in all the devices according to the device information, wherein the performance parameters are used for representing the performance conditions of the corresponding devices;
arranging all the devices according to the sequence of the performance represented by the performance parameters of each device from top to bottom to obtain the arrangement sequence of all the devices;
determining a preset number of target devices positioned at the front in the arrangement sequence;
and setting the preset number of target devices as candidate agent devices of the first subnet.
4. The method of claim 3, wherein after setting the preset number of target devices as candidate proxy devices for the first subnet, the method further comprises:
when determining that a new device search request for the website address range exists, sending the new device search request to a proxy device of the candidate proxy devices in the first subnet;
and determining that feedback information sent by the agent equipment aiming at the new equipment search request is not received within a preset time length, and selecting new agent equipment from the candidate agent equipment to send the new equipment search request.
5. A device discovery method is applied to a terminal device, and is characterized by comprising the following steps:
receiving an equipment search request sent by a central management node; the destination address carried in the device search request is an IP address determined by randomly scanning a website range configured by a user by the central management node;
determining whether the device has a device discovery function;
if the device does not have the device discovery function, forwarding the device search request in the current subnet; wherein, the forwarded device search request carries the IP address of the central management node;
if the terminal equipment is determined to have the equipment discovery function, searching all equipment in a current subnet according to the equipment search request, wherein the current subnet is the subnet in which the terminal equipment is located;
and acquiring the equipment information of all the equipment, and sending the equipment information of all the equipment to the central management node.
6. A server, comprising:
the device comprises a sending module, a searching module and a searching module, wherein the sending module is used for determining a first Internet Protocol (IP) address in a website range configured by a user through random scanning and sending a device searching request by taking the first IP address as a destination address; the device searching request is used for searching and discovering terminal devices in the network;
a first determining module, configured to determine, according to feedback information sent by the terminal device corresponding to the first IP address according to the device search request, a first subnet of the at least two subnets where the terminal device is located, if the feedback information is received; the feedback information is used for indicating a network segment of a subnet where the terminal equipment is located;
an obtaining module, configured to receive device information of all terminal devices found by the terminal device in the first subnet according to the device search request when the terminal device is a strong node;
when the terminal device is a weak node, the obtaining module is configured to receive device information of the terminal device, which is sent by other terminal devices in the first subnet except the terminal device according to the device search request forwarded by the terminal device.
7. The server of claim 6, wherein the server further comprises:
a second determining module, configured to determine, after determining a first subnet of the at least two subnets where the terminal device is located according to the feedback information, a first network segment corresponding to the first subnet in the website range configured by the user;
the sending module is used for randomly scanning and determining a second IP address which is positioned outside the first network segment in the website range configured by the user, sending the equipment search request by taking the second IP address as a destination address, and acquiring equipment information of all equipment positioned in a second subnet, wherein the network segment of the second subnet is the network segment where the second IP address is positioned.
8. The server of claim 6, wherein the server further comprises:
a third determining module, configured to determine, after acquiring device information of all devices in the first subnet, a performance parameter of each device in the all devices according to the device information, where the performance parameter is used to characterize a performance condition of a corresponding device;
the sorting module is used for sorting all the equipment according to the sequence of the performance represented by the performance parameter of each equipment from top to bottom to obtain the sorting sequence of all the equipment;
a setting module, configured to determine a preset number of target devices located at a top position in the ranking order, and set the preset number of target devices as candidate proxy devices of the first subnet;
the sending module is further configured to send a new device search request to a proxy device of the candidate proxy devices in the first subnet when it is determined that the new device search request for the website address range exists after the preset number of target devices are set as the candidate proxy devices in the first subnet; and determining that feedback information sent by the agent equipment aiming at the new equipment search request is not received within a preset time length, and selecting new agent equipment from the candidate agent equipment to send the new equipment search request.
9. A terminal device, comprising:
the receiving module is used for receiving an equipment searching request sent by the central management node; the destination address carried in the device search request is an IP address determined by randomly scanning a website range configured by a user by the central management node;
the device comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining whether the device has a device discovery function or not;
the searching module is used for searching all devices in a current subnet according to the device searching request if the device discovering function is determined to be possessed by the searching module, wherein the current subnet is the subnet where the terminal device is located;
the operation module is used for acquiring the equipment information of all the equipment and sending the equipment information of all the equipment to the central management node;
the operation module is further configured to: if the device does not have the device discovery function, forwarding the device search request in the current subnet; wherein, the forwarded device search request carries the IP address of the central management node.
10. A computer arrangement, characterized in that the computer arrangement comprises a processor for implementing the method according to any of claims 1-5 when executing a computer program stored in a memory.
11. A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-5.
CN201810048839.0A 2018-01-18 2018-01-18 Device discovery method and device Active CN108200567B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810048839.0A CN108200567B (en) 2018-01-18 2018-01-18 Device discovery method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810048839.0A CN108200567B (en) 2018-01-18 2018-01-18 Device discovery method and device

Publications (2)

Publication Number Publication Date
CN108200567A CN108200567A (en) 2018-06-22
CN108200567B true CN108200567B (en) 2021-04-16

Family

ID=62589704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810048839.0A Active CN108200567B (en) 2018-01-18 2018-01-18 Device discovery method and device

Country Status (1)

Country Link
CN (1) CN108200567B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110022219B (en) * 2019-04-12 2021-09-24 深圳市网心科技有限公司 Network cluster detection method and system, electronic device and storage medium
CN110635942B (en) * 2019-09-02 2022-11-04 上海商米科技集团股份有限公司 Device discovery method, internet of things device and Internet of things server
CN111147527A (en) * 2020-03-09 2020-05-12 深信服科技股份有限公司 Internet of things system and equipment authentication method, device, equipment and medium thereof
CN113765967A (en) * 2020-09-11 2021-12-07 北京沃东天骏信息技术有限公司 Device searching method, device and storage medium
CN112333296B (en) * 2020-10-19 2021-08-31 中标慧安信息技术股份有限公司 Equipment discovery method and system
CN112579147A (en) * 2020-12-14 2021-03-30 武汉联影医疗科技有限公司 Software integration method and system

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101083581A (en) * 2006-05-30 2007-12-05 明基电通(上海)有限公司 Method and apparatus for controlling multicasting in self-organizing peer-to-peer network
CN101729507A (en) * 2008-10-14 2010-06-09 中兴通讯股份有限公司 Method and device for discovering and recognizing network devices
CN102089757A (en) * 2008-10-03 2011-06-08 益焦.com有限公司 Systems and methods for automatic creation of agent-based systems
CN102638382A (en) * 2011-02-14 2012-08-15 上海华为技术有限公司 Method for realizing DLNA (Digital Living Network Alliance) and DLNA agent equipment
CN103812672A (en) * 2012-11-06 2014-05-21 浙江大华技术股份有限公司 Method for discovering newly-added network element device, correlative device, and system
CN104079659A (en) * 2014-07-14 2014-10-01 清华大学 Location-based service anonymous query system based on random agents and application method thereof
CN104247333A (en) * 2011-12-27 2014-12-24 思科技术公司 System and method for management of network-based services
CN104660563A (en) * 2013-11-21 2015-05-27 中国移动通信集团公司 Method, equipment and system for processing active detection response
CN105245607A (en) * 2015-10-23 2016-01-13 中国联合网络通信集团有限公司 Proxy server dynamic automatic selection method and system
CN105682182A (en) * 2014-11-19 2016-06-15 中国移动通信集团公司 Device discovery and device connection method, device and system
CN106899444A (en) * 2015-12-21 2017-06-27 北京奇虎科技有限公司 A kind of end-probing method and device for many LANs

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160306887A1 (en) * 2013-12-03 2016-10-20 Beijing Qihoo Technology Company Limited Methods, apparatuses and systems for linked and personalized extended search
KR101575229B1 (en) * 2014-04-07 2015-12-07 주식회사 코난테크놀로지 User terminal for multi data searching and searching method thereof

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101083581A (en) * 2006-05-30 2007-12-05 明基电通(上海)有限公司 Method and apparatus for controlling multicasting in self-organizing peer-to-peer network
CN102089757A (en) * 2008-10-03 2011-06-08 益焦.com有限公司 Systems and methods for automatic creation of agent-based systems
CN101729507A (en) * 2008-10-14 2010-06-09 中兴通讯股份有限公司 Method and device for discovering and recognizing network devices
CN102638382A (en) * 2011-02-14 2012-08-15 上海华为技术有限公司 Method for realizing DLNA (Digital Living Network Alliance) and DLNA agent equipment
CN104247333A (en) * 2011-12-27 2014-12-24 思科技术公司 System and method for management of network-based services
CN103812672A (en) * 2012-11-06 2014-05-21 浙江大华技术股份有限公司 Method for discovering newly-added network element device, correlative device, and system
CN104660563A (en) * 2013-11-21 2015-05-27 中国移动通信集团公司 Method, equipment and system for processing active detection response
CN104079659A (en) * 2014-07-14 2014-10-01 清华大学 Location-based service anonymous query system based on random agents and application method thereof
CN105682182A (en) * 2014-11-19 2016-06-15 中国移动通信集团公司 Device discovery and device connection method, device and system
CN105245607A (en) * 2015-10-23 2016-01-13 中国联合网络通信集团有限公司 Proxy server dynamic automatic selection method and system
CN106899444A (en) * 2015-12-21 2017-06-27 北京奇虎科技有限公司 A kind of end-probing method and device for many LANs

Also Published As

Publication number Publication date
CN108200567A (en) 2018-06-22

Similar Documents

Publication Publication Date Title
CN108200567B (en) Device discovery method and device
EP3550892B1 (en) Method for network slice selection, user equipment, and network device
US10045238B2 (en) Providing easy access to radio networks
JP6009700B2 (en) Peer-to-peer pre-association discovery operation
US8874710B2 (en) Access network discovery
EP2983391B1 (en) Method and apparatus for wlan initial link setup
WO2013131472A1 (en) Message processing method, device and system
EP3512118A1 (en) Method and device for transmitting response message
EP3163946B1 (en) Transmission list in wi-fi acces point
JP2019525518A (en) Method for establishing a network cluster between networked devices
EP2770701B1 (en) Apparatus and method for providing a wireless communication in a portable terminal
US10149134B2 (en) Near field discovery method, user equipment, and storage medium
US20140355589A1 (en) Feedback method for active scanning of user terminal, and access point
US20180368049A1 (en) Method and apparatus for gathering network neighborhood information and generating a reduced neighbor report
KR20160114127A (en) Network access selection based on internet protocol-media subsystem service
TW201611549A (en) Network device and method for routing
US20180006997A1 (en) Communication apparatus, control method, and computer readable storage medium
CN112087532B (en) Information acquisition method, device, equipment and storage medium
EP3637859B1 (en) Hidden hotspot scanning based on a match of mac addresses
JP6698700B2 (en) Aggregating target and exploration queries
CN111294314A (en) Message processing method, device and system
CN111294414A (en) Message processing method, device and system
EP4307642A1 (en) Information processing method and apparatus, and communication device
CN112312420B (en) Method and device for processing and configuring minimization of drive test, terminal and network side equipment
US11050860B2 (en) Method and apparatus for network address analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant