Lightweight network neighbor discovery method and related equipment

By employing a lightweight network neighbor discovery method and utilizing UDP port listening and fragmented response mechanisms to construct TLV format packets, the problem of mobile terminals having difficulty obtaining wireless access point information is solved. This achieves efficient and low-overhead device identification and information collection, and is applicable to devices such as multi-service routers and smart APs.

CN121984871APending Publication Date: 2026-05-05SHANGHAI BAUD DATA COMM
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI BAUD DATA COMM
Filing Date
2026-01-19
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In modern communication networks, mobile terminals struggle to quickly and accurately obtain information about wireless access points, and the device discovery process is susceptible to high packet loss rates and resource limitations in wireless networks, resulting in low network management efficiency.

Method used

A lightweight network neighbor discovery method is adopted, which constructs TLV format packets through UDP port listening and fragmented response mechanism, and combines BSSID to look up the access point IP address, and transfers the discovery task to the wired network to avoid wireless packet loss.

Benefits of technology

It achieves efficient and low-overhead device identification and information collection, supports high-density device discovery, reduces packet loss rate, and improves the reliability and accuracy of discovery, making it suitable for resource-constrained scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_1
    Figure SMS_1
  • Figure SMS_2
    Figure SMS_2
  • Figure SMS_3
    Figure SMS_3
Patent Text Reader

Abstract

The invention discloses a lightweight network neighbor discovery method and related equipment, and the method comprises the steps: enabling all equipment in a network to run a monitoring process, binding and monitoring a predetermined UDP port; when equipment in the network needs to be subjected to discovery operation, broadcasting a protocol discovery message to the local area network by the UDP port of the current equipment; and all the devices in the network receiving the broadcast receive the request through the bound UDP monitoring port, and reply own device information through a UDP response message after confirming that the devices meet reply conditions. According to the scheme, rapid identification and information acquisition can be performed on equipment in a network in a local area network or a private network environment with high efficiency and low overhead, and the problems in the prior art can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer network technology, specifically relating to discovery protocol technology applicable to devices such as multi-service routers and smart APs. Background Technology

[0002] In modern communication networks, centralized software systems are typically used to monitor and manage network communication devices (such as routers, switches, and wireless access points) in a unified manner to achieve visualized network management and improve operational efficiency. Therefore, the ability to quickly and accurately obtain operational information and identity characteristics of devices within the network has become one of the key fundamental capabilities of network management systems.

[0003] Especially in practical engineering applications, many network devices use embedded hardware platforms. These devices are limited by processing power, memory, and network bandwidth, making it impossible to support complex or heavyweight network discovery protocols (such as LLDP and SNMP). Therefore, designing a lightweight, efficient, and low-resource-consumption device discovery mechanism is crucial for multi-service routers. It can not only improve the overall network visibility, response efficiency, and device compatibility, but also play a significant role in practical applications.

[0004] Meanwhile, to meet the needs of mobile and intelligent debugging and deployment, network management is increasingly being performed using mobile terminals (such as smartphones or tablets). However, there are several challenges in using mobile terminals for network management, with the following two being the most prominent: (1) Mobile terminals have difficulty obtaining specific information about wireless access points (APs): In the current network architecture, after a mobile device connects to a wireless network, it can often only obtain the IP address and default gateway address assigned to the mobile device itself. It cannot directly know the real IP address or device identifier of the wireless access point it is connected to, which brings practical obstacles to network optimization, positioning and remote control operations.

[0005] (2) Device discovery initiated directly by mobile terminal has packet loss and efficiency bottleneck: If device discovery is initiated by mobile terminal, the protocol message needs to be broadcast and retrieved through the air interface. In the face of the common high packet loss rate problem in wireless networks, the integrity of the discovery result will be seriously affected. If an acknowledgment (ACK) mechanism is adopted, a large amount of response information will be lost. If an acknowledgment mechanism is adopted, it will cause problems such as air interface occupation and bandwidth waste. Summary of the Invention

[0006] To address the issues of efficiency and reliability in existing communication network device discovery technologies, the present invention aims to provide a lightweight network neighbor discovery method. This method can efficiently and with low overhead achieve rapid identification and information collection of devices in the network, effectively overcoming the problems existing in the prior art.

[0007] To achieve the above objectives, the present invention provides a lightweight network neighbor discovery method, including: All devices in the network run a listening process, which is configured to monitor the first UDP port and the second UDP port of the device. The first UDP port is configured as the port listened to by the active discoverer, and the second UDP port is configured as the port listened to by the discovered device. When a device in the network needs to perform a discovery operation, the first UDP port of the current device broadcasts a protocol discovery message to the local area network. All devices in the network that receive the broadcast receive the request through the bound second UDP listening port, and after confirming that they meet the reply conditions, reply with their own device information through a UDP response message.

[0008] Furthermore, the discovery method also constructs a fragmented response mechanism, which enables devices in the discovered network to map the delay time of the reply message to a preset fixed time slice as the packet transmission delay after receiving a broadcast, using a hash algorithm.

[0009] Furthermore, the discovery message in the discovery method uses the TLV format to construct the message body.

[0010] Furthermore, the discovery message can be configured with filtering conditions to request responses only from devices in the network that meet the conditions.

[0011] Furthermore, the discovery method also establishes a mechanism for devices in the network to look up the IP address of the connected access point. The devices in the network fill the BSSID into the TLV part of the broadcast message, so that the connected access point will query the MAC address of the local wireless port after receiving the broadcast message. If the BSSID exists, it will reply to the terminal; otherwise, it will discard the message.

[0012] Furthermore, the discovery method also establishes a mechanism for devices in the network to indirectly discover each other using access points. After a device in the network that performs an active discovery operation queries the IP address of the directly connected access point through an APP, it controls the access point to perform discovery behavior, so that the access point collects information of all devices in the network through the wired network, and then sends the results to the terminal that performs the active discovery operation through a protocol with a retransmission mechanism.

[0013] To achieve the above objectives, the present invention also provides a computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the steps of the lightweight network neighbor discovery method described above.

[0014] To achieve the above objectives, the present invention also provides a processor for running a program that, when running, executes the steps of the lightweight network neighbor discovery method described above.

[0015] To achieve the above objectives, the present invention also provides a terminal device, the device including a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program code is loaded and executed by the processor to implement the steps of the above-described lightweight network neighbor discovery method.

[0016] To achieve the above objectives, the present invention also provides a computer program product that, when executed on a data processing device, is adapted to perform the steps of the lightweight network neighbor discovery method described above.

[0017] The lightweight network neighbor discovery scheme provided by this invention has the following advantages over existing technologies: (1) Lightweight implementation and simple deployment: It is implemented using pure UDP, without the need for a complex protocol stack, and is suitable for resource-constrained scenarios such as embedded systems, IoT, and edge devices; (2) Support for high-density device discovery: Through response suppression mechanism, UDP storms are avoided. Actual tests show that it can support responses from tens of thousands of devices without packet loss. (3) High scalability: The message adopts the TLV format to support the dynamic addition of fields and can carry business attributes or status indicators; (4) Supports terminal devices to identify the IP address of the access point, making it convenient for relevant personnel to access the device for wireless optimization.

[0018] (5) By transferring the device discovery task in the network from the device (such as a wireless terminal) to the access point and collecting data in the wired network, the risk of packet loss due to unstable wireless links is significantly reduced, and the overall reliability and accuracy of discovery are improved. Detailed Implementation

[0019] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further explained below with reference to specific examples.

[0020] To address the problems encountered in obtaining device-related information in existing network management practices, this invention provides a lightweight network neighbor discovery scheme. This scheme enables efficient and low-overhead discovery of devices such as multi-service routers and smart APs in the network, and supports wireless terminals to look up wireless access point addresses through access information and control them to perform discovery operations.

[0021] Specifically, the lightweight network neighbor discovery scheme proposed in this invention first constructs an innovative neighbor discovery protocol mechanism, which can efficiently and with low overhead quickly identify the corresponding network devices in a local area network or dedicated network environment and complete the corresponding information collection.

[0022] As an example, in typical application scenarios, multi-service routers, as the control core of the network, can use this discovery protocol mechanism to uniformly discover and collect information on devices such as switches and AP nodes in the network, thereby achieving automatic identification and status awareness of the local area network topology.

[0023] Based on the above solution, the present invention further constructs a mechanism for reverse lookup of the IP address of the connected access point (AP). This reverse lookup mechanism enables the wireless terminal to reverse lookup of the IP address of the connected access point (AP) through the BSSID, which facilitates the terminal to obtain local network structure information and helps with wireless network optimization and terminal management.

[0024] The present invention further constructs an indirect discovery mechanism under the control of a wireless terminal. Based on this discovery mechanism, the device discovery operation in the network is transferred to the wired access point for execution, thereby avoiding the problem of high packet loss rate in the wireless link and improving the integrity and stability of discovery.

[0025] The following details the implementation process of the lightweight network neighbor discovery scheme provided by this invention.

[0026] The lightweight network neighbor discovery method provided in this invention first constructs a corresponding neighbor discovery protocol mechanism. Under this neighbor discovery protocol mechanism, all devices in the network are configured to run a listening process, which binds to and listens to a predetermined UDP port.

[0027] Specifically, each process listens on two UDP ports of the device: the first UDP port and the second UDP port.

[0028] The first UDP port is used as the listening port of the active discovery end to send active discovery requests and receive responses from other devices. The second UDP port is used as the listening port of the discovery end to accept active discovery requests and send responses.

[0029] Based on this, when a device in the network (such as a network device or terminal) needs to perform a discovery operation, the first UDP port of the current device (e.g., 61015) broadcasts a protocol discovery message to the local area network. The destination IP address is the broadcast address, and the destination UDP port is the second UDP port of the device in the network.

[0030] Furthermore, when all network devices that receive the broadcast receive the request through the bound second UDP listening port, and after confirming that they meet the reply conditions, they reply with their own device information to the source IP address of the message via a UDP response message.

[0031] Based on this, the present invention further constructs a fragmented response mechanism, under which the response times of multiple devices can be distributed into different time segments within a preset time window to avoid network congestion caused by simultaneous responses.

[0032] Specifically, the time segments mentioned here can be generated by random numbers, hash mappings, or other methods, so that the discovered network devices will distribute their reply messages within a preset time slice after receiving the broadcast message.

[0033] As further explanation, the corresponding delay value can be obtained by hashing the device's MAC address with the current timestamp and mapping the hash result to a fixed time slice range, or by generating a pseudo-random number based on the device's MAC address as a random seed and mapping it to a specified delay interval, or by other methods.

[0034] By using the aforementioned delayed generation method, in large-scale discovery scenarios, the response messages of each device can be evenly distributed within a preset time period, such as 1 to 5000 milliseconds, thereby effectively reducing congestion caused by centralized responses and alleviating the processing pressure on the proactive discovery end.

[0035] As a further explanation, the messages given in this invention (such as the aforementioned proactive discovery query messages and the messages replied by the discovered device) specifically employ the TLV format to construct the message body, so as to flexibly select the information to be sent. Using the TLV format to construct the message body here not only allows for flexible selection of the fields to be sent, but also allows for the definition of new TLV types when extending the protocol.

[0036] Building upon this foundation, the message can further support field extensions. To address extension needs, TLV types can be further defined during protocol extension to meet the requirements for collecting device information.

[0037] As an example, the message provided in this invention includes a basic field and a TLV field. The basic field can be used to configure MAC address, IP address, device type, device model, software version, etc. If required by the business, the TLV field can be further expanded to add types such as device load, whether the device has cloud management enabled, and device priority.

[0038] Furthermore, filtering conditions can be set in this message to request only responses from specific types or levels of devices.

[0039] As an example, this filtering condition can be configured through the Device-type field in the protocol. For instance, the required device type for the response can be configured in the Device-type field of the proactive query message, thus specifying the device type that is allowed to reply to this query. In this way, the device receiving the proactive query message checks whether its own device type is included in the Device-type field. If it is, it replies to this message; otherwise, it discards the message.

[0040] Furthermore, the messages generated by this invention can carry signature fields or encryption fields to improve communication security and prevent forged responses.

[0041] As further explanation, the QUERY message carries a signature field used to verify the authenticity of the Discoverer. This can be implemented using the HMAC algorithm. When forming the signature field in the message based on the HMAC algorithm, the key used is a key uniformly configured across all devices, using the default value at the factory. The raw data used to generate the signature in the QUERY message consists of the Agent-id (24 bytes) and the UDP Source Port of the IP packet containing the QUERY, directly concatenated in the above order. After receiving the QUERY, the Responder will calculate the signature in the same way and verify whether the signatures match.

[0042] As further explanation, the payload of both QUERY and RESPONSE messages uses DES to encrypt the raw data, enhancing data security. The DES key is a uniformly configured key across all devices, using the default value at the factory. Upon receiving a QUERY or RESPONSE message, the device must decrypt the payload using the DES key before parsing the data within the payload.

[0043] This invention further constructs a mechanism for devices in the network to look up the IP address of the access point they are connected to. This mechanism uses the formation of corresponding messages to enable the terminal to look up the AP information.

[0044] Specifically, based on this mechanism, devices in the network fill the BSSID into the TLV field of the broadcast message, so that the connected access point will query the MAC address of the local wireless port after receiving the broadcast message. If the BSSID exists, it will reply to the terminal; otherwise, it will discard the message.

[0045] As a further explanation, in the network constructed by this invention, the device reverse lookup mechanism for the IP address of the connected access point is implemented. The terminal device will initiate an active query, sending multiple active query messages through the wireless link, specifying the opcode field in the message as "LOOKUP_AP" (i.e., "terminal discovery AP mode"), and filling the BSSID into the TLV field of the message. Since the UDP protocol may lose packets in the wireless link, a number of active query messages are sent at intervals.

[0046] Accordingly, the broadcast message will be sent to the local area network. After receiving the query message, the communication equipment will discard the message according to the meaning of the operation code in the query message, except for the AP.

[0047] Since the BSSID specifically corresponds to the MAC address of the wireless network port of the AP associated with the terminal, the AP will look up the port list based on the BSSID field. If the AP does not find the BSSID in the port list, it will discard the packet. If the AP finds the BSSID successfully, it is the AP associated with the terminal. This AP device will reply with a query packet, filling in its own IP address and other information in the reply packet. The BSSID must also be filled in the reply packet.

[0048] Finally, upon receiving this response, the terminal can parse out the information of the associated AP.

[0049] This invention further constructs a device discovery mechanism in the network (i.e., a mechanism for indirect discovery of devices in the network using access points). Under this device discovery mechanism, after a device in the network performing an active discovery operation queries the IP address of the directly connected access point through the APP, it controls the access point to perform discovery behavior. This allows the access point to collect information of all devices in the network through the wired network and then send the results to the terminal performing the active discovery operation through a protocol with a retransmission mechanism, thereby avoiding the packet loss phenomenon that occurs when discovering directly through the wireless network.

[0050] The following specific examples further illustrate the implementation process of the lightweight network neighbor discovery scheme provided by this invention.

[0051] In this example, lightweight network neighbor discovery is implemented by forming a corresponding lightweight network neighbor discovery protocol. The corresponding implementation process is as follows: First, a lightweight network neighbor discovery protocol is constructed.

[0052] Protocol design: (1) IP address and UDP port The "device performing the active discovery operation" (hereinafter referred to as Discoverer) sends a query message to the "device that needs to be discovered" (hereinafter referred to as Responder). The destination IP address is the restricted broadcast IP address 255.255.255.255, and the destination MAC address is ff:ff:ff:ff:ff:ff.

[0053] The destination IP address of the RESPONSE message sent by the Responder to the Discoverer is the Discoverer's IP address.

[0054] The UDP Destination Port for the QUERY message is 61015, and the UDP Destination Port for the RESPONSE message is 61014.

[0055] (2) Message format QUERY message format

[0056] Format of RESPONSE message

[0057] The meanings of each field are as follows: ver: Protocol version number; type: Reserved value; code: Currently used to identify QUERY and RESPONSE messages; ID: A 24-byte data string used to uniquely identify a Discoverer. The Discoverer must carry this ID in the QUERY message; a 24-bit random value is allowed. The RESPONES message must carry the same ID as the one in the received QUERY message. Signature: The QUERY message Signature is a 20-byte HMAC message authentication code, i.e., a signature, used by the Responder to verify the Discoverer's authenticity. The key is a uniformly configured key, and the QUERY message consists of a data block used to generate the Signature, which is a direct concatenation of the ID and the message's UDP Source Port in the above order. Payload: This is the result of encrypting plaintext data using DES. As a supplementary note, the DES key used here is a uniformly configured key.

[0058] The plaintext format of the payload is as follows:

[0059] The meanings of each field in the payload are as follows: Flags: Reserved fields; Reserved: This field is reserved for future use. Opcode: The opcode indicates the type of operation being performed. Available values ​​include: 0 indicates a normal discovery behavior; 1 indicates LOOKUP_AP, which retrieves AP information via BSSID, and the TLV must include the BSSID; 2 indicates FIND_AC, and the TLV must include the AC's priority. As a supplementary explanation, FIND_AC here indicates an AP's proactive request to discover AC devices, where Device-Type must be AC, used by the AP to automatically obtain the AC's IP address for online access.

[0060] Sequence-ID: Sequence number, representing the sequence number of the sent message, used to identify a discovery action; If the Opcode or Sequence-ID in the RESPONSE message received by the discoverer is not equal to the Opcode field in the QUERY message, the Response message needs to be discarded.

[0061] Device-Type: This field can specify multiple device types using bits. In a QUERY message, it specifies the type of the target receiving device; only devices containing the specified type will reply to this message. In a RESPONSE message, it specifies the current device type.

[0062] TLV: Defines various attributes such as IP address, MAC address, device priority, software version, device name, device model, and BSSID.

[0063] Next, a fragmented response mechanism is constructed.

[0064] After receiving a QUERY, the Responder device uses a hash (MAC address + current timestamp) to map to a fixed time slice (each slice is 5ms, for a total of 1000 slices). Within this specified time slice, it replies with a message, which ensures that the Responder devices' reply messages are evenly distributed throughout the process, reducing the processing burden on the Discovery device and preventing packet loss.

[0065] Next, the IP address of the AP is queried using the BSSID.

[0066] On mobile devices, the accompanying APP obtains the BSSID (i.e., the MAC address of a certain wireless port of the access point) of the current Wi-Fi connection through the system interface. The APP encapsulates the BSSID in the TLV of the QUERY message, sets the Opcode value to LOOKUP_AP, sets the Device-type to AP, and sends it to the local area network via broadcast; All AP devices are configured to, upon receiving this broadcast, parse the BSSID and check their own wireless interface MAC address list for a MAC address that matches the BSSID field in the message. If a match is found, a reply message is required, carrying the BSSID (for the app to confirm again), IP address, and other information in the TLV.

[0067] In the above process, only the AP connected to the terminal can successfully find the MAC address that is the same as the BSSID in the wireless port list. Therefore, only this AP will reply in the end, and the terminal can resolve the AP's IP address and other information through the RESPONSE message.

[0068] Next, device discovery is performed via a wireless terminal.

[0069] After the wireless terminal uses the APP to find the AP's IP address, it can control the AP to start the discovery operation through the corresponding HTTP interface. The AP sends a QUERY message on the wired network port, collects the information of all devices, and then transmits the device information to the terminal in a unified manner through the HTTP protocol.

[0070] Therefore, the role of the Discoverer has shifted from a wireless terminal to an access point (AP). The discovery process takes place in the wired network, and all messages replied by the Responder do not need to pass through the wireless network, thus avoiding the problem of high packet loss rate in wireless networks.

[0071] Based on the above lightweight network neighbor discovery scheme, this embodiment of the invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the steps of the above lightweight network neighbor discovery method.

[0072] This invention also provides a processor for running a program, wherein the program executes the steps of the lightweight network neighbor discovery method described above.

[0073] This invention also provides a terminal device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. The program code is loaded and executed by the processor to implement the steps of the lightweight network neighbor discovery method described above.

[0074] The present invention also provides a computer program product, which, when executed on a data processing device, is adapted to perform the steps of the above-described lightweight network neighbor discovery method.

[0075] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0076] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0077] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0078] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.

[0079] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0080] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0081] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0082] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0083] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0084] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0085] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0086] The method, specific system unit, or part thereof of the present invention described above is a pure software architecture. It can be deployed via program code on physical media, such as hard disks, optical discs, or any electronic device (such as smartphones or computer-readable storage media). When a machine loads and executes the program code (e.g., a smartphone loads and executes it), the machine becomes a device for implementing the present invention. The method and device of the present invention can also be transmitted in program code form via transmission media, such as cables, optical fibers, or any other transmission method. When the program code is received, loaded, and executed by a machine (e.g., a smartphone), the machine becomes a device for implementing the present invention.

[0087] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A lightweight network neighbor discovery method, characterized in that, include All devices in the network run a listening process, which is configured to monitor the first UDP port and the second UDP port of the device. The first UDP port is configured as the port listened to by the active discoverer, and the second UDP port is configured as the port listened to by the discovered device. When a device in the network needs to perform a discovery operation, the first UDP port of the current device broadcasts a protocol discovery message to the local area network. All devices in the network that receive the broadcast receive the request through the bound second UDP listening port, and after confirming that they meet the reply conditions, reply with their own device information through a UDP response message; The discovery method establishes a mechanism for devices in the network to look up the IP address of the access point they are connected to. This mechanism generates corresponding messages to allow the terminal to look up AP information. First, the terminal device initiates an active query by sending multiple active query messages via the wireless link, specifying the opcode field in the message as the terminal discovery AP mode LOOKUP_AP, and filling the BSSID into the TLV field of the message. The BSSID corresponds to the MAC address of the wireless network port of the AP associated with the terminal device. Then, the query message is broadcast to the local area network. After receiving the query message, the communication device discards the message according to the meaning of the opcode in the query message, except for the AP device. At the same time, the AP device will look up the port list according to the BSSID field. AP devices that do not find the BSSID in the port list will discard the message, while AP devices that successfully find the BSSID are the APs associated with the terminal and will reply with a query message, filling in their own information including IP address and BSSID. Then, after receiving this reply, the terminal device can parse the information of the associated AP device. Based on the network's mechanism for reverse lookup of the IP address of the connected access point, device discovery can be performed via a wireless terminal. After the wireless terminal finds the IP address of the AP device, it can control the AP device to start the discovery operation through the corresponding HTTP interface. The AP device sends a QUERY message on the wired network port and collects the reply messages from responding devices through the wired network. After collecting the information of all devices based on the wired network, the device information is uniformly transmitted to the wireless terminal via the HTTP protocol.

2. The lightweight network neighbor discovery method according to claim 1, characterized in that, The discovery method also constructs a fragmented response mechanism, which enables devices in the discovered network to map the delay time of the reply message to a preset fixed time slice as the packet sending delay after receiving a broadcast through a hash algorithm.

3. The lightweight network neighbor discovery method according to claim 1, characterized in that, The discovery message in the discovery method uses the TLV format to construct the message body.

4. The lightweight network neighbor discovery method according to claim 3, characterized in that, The discovery message can be configured with filtering conditions to request responses only from devices in the network that meet the conditions.

5. The lightweight network neighbor discovery method according to claim 1, characterized in that, In the network's mechanism for devices to look up the IP address of the access point they are connected to, the terminal device sends multiple active query messages at intervals.

6. The lightweight network neighbor discovery method according to claim 1, characterized in that, The discovery method also establishes a mechanism for devices in the network to indirectly discover each other using access points. After a device in the network that performs an active discovery operation queries the IP address of the directly connected access point through an APP, it controls the access point to perform discovery behavior. This allows the access point to collect information about all devices in the network through the wired network and then send the results to the terminal that performed the active discovery operation through a protocol with a retransmission mechanism.

7. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the lightweight network neighbor discovery method according to any one of claims 1-6.

8. A processor for running a program, characterized in that, When the program runs, it performs the steps of the lightweight network neighbor discovery method according to any one of claims 1-6.

9. A terminal device, comprising a processor, a memory, and a program stored in the memory and executable on the processor, characterized in that, The program is loaded and executed by the processor to implement the steps of the lightweight network neighbor discovery method according to any one of claims 1-6.

10. A computer program product, characterized in that, When executed on a data processing device, it is suitable for performing the steps of the lightweight network neighbor discovery method according to any one of claims 1-6.