Equipment discovery method and device, electronic equipment and computer readable storage medium
By establishing a binding relationship between the receiving device and the sending device, and controlling the receiving device's response to multicast query information, the privacy and security issues in device discovery technology are resolved, and device privacy protection is achieved.
Patent Information
- Application Number
- CN202511617127.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-27
AI Technical Summary
Existing device discovery technologies expose devices on a local area network to a public, open state, raising privacy and security concerns.
By establishing a binding relationship between the receiving device and the sending device, the response of the receiving device to multicast query information is controlled, and the device only responds to devices that meet the binding relationship, avoiding responses to other devices.
It enhances the privacy and security of receiving devices, preventing them from being incorrectly or maliciously connected by unbound devices, thus improving device privacy protection.
Smart Images

Figure CN121585718A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of device discovery technology, specifically to a device discovery method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Device discovery technology or mechanisms are key technologies in network communication, used to automatically identify and locate devices and services within a network. Local area network (LAN)-based device discovery mechanisms generally involve three device roles: the sender, the router, and the receiver. Figure 1 The device discovery mechanism in a local area network (LAN) projection protocol generally works as follows: the receiving end can periodically announce device information and service capabilities to the multicast group within the LAN via UDP multicast on a fixed port. Simultaneously, it listens for UDP multicast transmissions from the sending end on the same port, waiting for the sending end to initiate or further inquiries, and responds to the sending end's UDP multicast transmissions via UDP unicast transmissions on the same port. The multicast and unicast transmissions and receptions between the sending and receiving ends are forwarded by a router. Furthermore, the sending end can passively learn about the receiving end's device information and service capabilities by listening to UDP multicast on the corresponding fixed port, and can actively or further query by sending UDP multicast on the aforementioned port, while waiting for the receiving end's query response by listening to UDP unicast on the aforementioned port.
[0003] However, current device discovery technologies or mechanisms make all devices on a local area network appear publicly open, posing privacy and security risks. Summary of the Invention
[0004] This application provides a device discovery method, apparatus, electronic device, and computer-readable storage medium, which can control the receiving devices discovered by the device discovery, thereby improving the privacy and security of the devices.
[0005] In a first aspect, embodiments of this application provide a device discovery method applied to a receiving device, the method comprising: Receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device; The response to the multicast query information is controlled according to the binding relationship with the sending device, and the response result is obtained.
[0006] Secondly, embodiments of this application also provide a device discovery apparatus, applied to a receiving device, the apparatus comprising: The receiving module is used to receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device; The sending module is used to control the response to the multicast query information according to the binding relationship with the sending end device, and obtain the response result.
[0007] Optionally, in some embodiments of this application, the response result includes either sending a unicast response to the multicast query information to the router device or not sending the unicast response information to the router device. The step of controlling the response to the multicast query information based on the binding relationship with the sending device, and obtaining the response result, includes: If the receiving device is bound to the sending device, a unicast response message for the multicast query message is sent to the router device, resulting in the router device sending a unicast response message for the multicast query message. The router device then forwards the unicast response message to the sending device. If the receiving device and the sending device are not bound together, then the unicast response information is not sent to the router device, resulting in the unicast response information not being sent to the router device.
[0008] Optionally, in some embodiments of this application, the multicast query information includes a first device discovery message based on SSDP or a second device discovery message based on mDNS.
[0009] Optionally, in some embodiments of this application, the method further includes: If a multicast announcement is detected, the router is prevented from sending the multicast announcement to the router device.
[0010] Optionally, in some embodiments of this application, the multicast announcement information includes a liveness announcement message based on SSDP or a query announcement message based on mDNS.
[0011] Optionally, in some embodiments of this application, the binding relationship is recorded on the receiving device; The receiving device establishes the binding relationship with the sending device by obtaining the identification information of the sending device; The identification information is carried in a QR code or a string.
[0012] Optionally, in some embodiments of this application, after the step of sending a unicast response to the multicast query information to the router device if the receiving device is bound to the sending device, and obtaining the result of sending a unicast response to the multicast query information to the router device, the method further includes: Receive a screen mirroring connection request forwarded by the router device, wherein the screen mirroring connection request is sent by the sending device to the router device; The router device sends a response to the screen mirroring connection request, and the router device forwards the response to the sending device.
[0013] Thirdly, embodiments of this application also provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps in the device discovery method described above.
[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the device discovery method described above.
[0015] Fifthly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in embodiments of this application.
[0016] In summary, in this embodiment of the application, the receiving device receives multicast query information forwarded by the router device. The multicast query information is sent from the sending device to the router device. The receiving device controls the response to the multicast query information according to the binding relationship with the sending device, and obtains the response result.
[0017] In this embodiment, the binding relationship controls whether the receiving device responds to multicast query information from the sending device. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This allows control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1This is a schematic diagram of the process before the improvement of the device discovery method provided in the embodiments of this application; Figure 2 This is a schematic diagram illustrating a scenario in which the receiving device executes the device discovery method according to an embodiment of this application; Figure 3 This is a schematic flowchart of the device discovery method provided in an embodiment of this application; Figure 4 This is a schematic diagram of the improved process corresponding to the device discovery method provided in the embodiments of this application; Figure 5 This is a schematic diagram of the device discovery apparatus provided in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0020] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] In the description of the embodiments of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, the terms "first," "second," "third," and "fourth" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first," "second," "third," and "fourth" may explicitly or implicitly include one or more features. In the description of the present invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0022] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0023] This application provides a device discovery method, apparatus, electronic device, and computer-readable storage medium. Specifically, this application provides a device discovery apparatus suitable for electronic devices (receiving devices), which include terminal devices or servers. The terminal devices include devices such as mobile phones, tablets, laptops, televisions, projectors, or monitors. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The server can be directly or indirectly connected via wired or wireless communication.
[0024] For example, please see Figure 2 , Figure 2 This is a schematic diagram illustrating a scenario where a receiving device executes the device discovery method according to an embodiment of this application. Specifically, the execution process of the receiving device executing the device discovery method is as follows: The receiving device 201 receives a multicast query message forwarded by the router device 202. The multicast query message is sent to the router device 202 by the sending device 203. The receiving device 201 controls the response to the multicast query message according to the binding relationship with the sending device 203, and obtains the response result.
[0025] For example, a scenario might involve multiple devices on the same local area network (LAN), such as mobile phones, TVs, tablets, routers, and conferencing machines. If the mobile phone (acting as the sending device) needs to project its screen, it sends a multicast query through the router. The router then forwards this multicast query to the receiving devices on the LAN, such as TVs, tablets, and conferencing machines. Only devices on the LAN that are paired with the mobile phone will respond to the multicast query. For instance, if the TV on the LAN is paired with the mobile phone, it will respond to the multicast query; if neither the tablet nor the conferencing machine is paired with the mobile phone, neither will respond.
[0026] Furthermore, the mobile phone can discover the device on the TV, establish a screen mirroring connection with the TV that responds to the multicast query, and project data from the mobile phone onto the TV.
[0027] In summary, this application embodiment controls whether the receiving device responds to multicast query information from the sending device through a binding relationship. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This achieves control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security.
[0028] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0029] Please see Figure 3 , Figure 3 This is a flowchart illustrating a device discovery method provided in an embodiment of this application. Although the flowchart shows a logical order, in some cases, the steps shown or described may be performed in a different order than that shown in the flowchart. Specifically, this device discovery method is applied to a receiving device, and the specific flow of the device discovery method is as follows: 301. Receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device.
[0030] Multicast query information refers to query information sent via multicast, such as query information sent via UDP multicast. Query information refers to querying device information for discovering devices within the local area network. For example, this multicast query information includes M-SEARCH-based query information sent via UDP multicast, or QM query information based on SRV records, etc.
[0031] The sending device includes devices that send multicast query information, including but not limited to mobile phones, tablets, and other devices. For example, after responding to a user's screen mirroring operation, a mobile phone generates multicast query information for device discovery to find available devices in the local area network.
[0032] Router devices are devices that enable data forwarding between sending and receiving devices. These include traditional routers, Layer 3 switches, or gateways, which are devices with data forwarding capabilities.
[0033] The receiving device refers to the device that receives the multicast query information. For example, the receiving device includes, but is not limited to, devices such as televisions and projectors.
[0034] 302. Control the response to the multicast query information according to the binding relationship with the sending device, and obtain the response result.
[0035] The binding relationship refers to the status information of whether a binding relationship has been established between the sending device and the receiving device. This binding relationship includes whether a binding relationship exists or not, that is, whether the sending device and the receiving device are bound or not. The sending device and the receiving device can establish a one-to-one binding through device addresses.
[0036] Understandably, by controlling whether the receiving device responds to the multicast query through the binding relationship, the receiving device can control the devices that the sending device can discover. This ensures that the receiving device does not respond to multicast queries from any device, and that the receiving device is not always in a public state in relation to other devices, thereby improving the privacy and security of the receiving device.
[0037] In summary, this application embodiment controls whether the receiving device responds to multicast query information from the sending device through a binding relationship. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This achieves control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security.
[0038] For example, please see Figure 4 , Figure 4This is a schematic diagram of the improved process corresponding to the device discovery method provided in this application embodiment. In this application embodiment, a response restriction is designed; that is, the receiving device will only respond to the received multicast query information if a binding relationship exists between the sending device and the receiving device. Optionally, in some embodiments of this application, the response result includes either sending a unicast response to the multicast query information to the router device or not sending the unicast response information to the router device. The step "controlling the response to the multicast query information according to the binding relationship with the sending device to obtain a response result" includes: If the receiving device is bound to the sending device, a unicast response message for the multicast query message is sent to the router device, resulting in the router device sending a unicast response message for the multicast query message. The router device then forwards the unicast response message to the sending device. If the receiving device and the sending device are not bound together, then the unicast response information is not sent to the router device, resulting in the unicast response information not being sent to the router device.
[0039] Understandably, when devices are bound together, the receiving device responds to the multicast query by replying with a unicast response to the sending device. When no binding exists between devices, the receiving device, upon receiving the multicast response, does not respond to the multicast query. The binding relationship indicates the user's expectations; for example, the user expects the sending device to discover the device through a device discovery mechanism and establish a connection. Therefore, controlling the response based on the binding relationship improves the rationality of device discovery control.
[0040] It's understandable that unicast response messages are responses to multicast query messages, transmitted via unicast. The receiving device responds to the multicast query message sent by the sending device by sending a unicast response message, enabling the sending device to discover the receiving device. This allows the sending device to use the receiving device as a connection target; for example, after the receiving device replies with a unicast response message, the sending device can use the receiving device as the target for screen mirroring.
[0041] The router device is used for data forwarding of multicast query information and unicast response information between the sending and receiving devices.
[0042] In summary, the embodiments of this application restrict the receiving devices that can respond through binding relationships, and control that only devices with binding relationships can be discovered by the sending devices.
[0043] In this embodiment of the application, the multicast query information includes a first device discovery message based on SSDP or a second device discovery message based on mDNS. For example, the router device sends the first device discovery information to the receiving device, or sends the second device discovery information to the receiving device.
[0044] In this embodiment, the first device discovery message includes a query message based on the M-SEARCH method. The second device discovery message includes a QM query message based on SRV records, where an SRV record (Service Record) defines the server address and port of a specific service, and QM stands for Query Method. When it is necessary to query the SRV record of a certain device or service, the corresponding device information or service information can be obtained by sending this QM query message.
[0045] It should be noted that in traditional device discovery technologies or mechanisms, the receiving device also announces its own device information and service capabilities via multicast to facilitate device discovery by the sending device. However, in this embodiment, to prevent the receiving device from being mistakenly discovered or maliciously connected by other devices, the receiving device itself blocks the multicast of its device information and service capabilities to other devices. That is, the receiving device controls itself not to multicast its own device information and service capabilities to other devices. In other words, the method further includes: If a multicast announcement is detected, the router is prevented from sending the multicast announcement to the router device.
[0046] Understandably, the receiving device controls itself not to multicast its device information and service capabilities to other devices. This prevents other devices from passively receiving the receiving device's device information and service capabilities, avoids the receiving device's device information and service capabilities being in a public state, reduces the chance of being discovered by other devices, and thus avoids incorrect or malicious connections from other devices, such as preventing incorrect or malicious screen mirroring.
[0047] It should be noted that this multicast announcement information is used to announce the device's information and service capabilities via multicast. This multicast announcement information includes SSDP-based liveness announcement messages (e.g., ssdp:alive announcement messages using the NOTIFY method) or mDNS-based query announcement messages (e.g., QM query messages for SRV records).
[0048] Optionally, in this embodiment, the binding relationship is recorded on the receiving device; the receiving device establishes the binding relationship with the sending device by obtaining the identification information of the sending device; the identification information is carried in a QR code or a string.
[0049] It is understandable that the binding relationship between the sending device and the receiving device is stored in the receiving device, enabling the receiving device to quickly determine whether to respond to the multicast query information of the sending device based on the stored binding relationship.
[0050] The identification information includes the device's model number, address, etc., which are used to uniquely identify the device.
[0051] The identification information is carried by QR codes or strings, which improves the efficiency of obtaining the identification information. For example, the identification information of the device can be quickly obtained by scanning the QR code, or the string can be directly read by scanning, thereby obtaining the identification information of the device.
[0052] Optionally, after device discovery is complete, a connection can be established between the sending and receiving devices. For example, please refer to [link to relevant documentation]. Figure 4 Taking screen mirroring connection as an example, after the step "If the receiving device and the sending device are bound together, then send a unicast response to the multicast query information to the router device to obtain the result of sending a unicast response to the multicast query information to the router device", the method further includes: Receive a screen mirroring connection request forwarded by the router device, wherein the screen mirroring connection request is sent by the sending device to the router device; The router device sends a response to the screen mirroring connection request, and the router device forwards the response to the sending device.
[0053] It is understandable that the sending and receiving devices achieve screen mirroring connection through the sending and responding of screen mirroring connection requests.
[0054] For example, if the sending device is a mobile phone and the receiving device is a television, after the mobile phone discovers the television through the device discovery method of this application embodiment, it establishes a screen casting connection with the television and projects the screen on the mobile phone onto the television.
[0055] In summary, this application embodiment controls whether the receiving device responds to multicast query information from the sending device through a binding relationship. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This achieves control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security.
[0056] Furthermore, the receiving device controls itself not to multicast its own device information and service capabilities to other devices, thereby preventing other devices from passively receiving the receiving device's device information and service capabilities, and preventing the receiving device's device information and service capabilities from being publicly available. This reduces the chances of being discovered by other devices and, consequently, prevents other devices from making incorrect or malicious connections, such as preventing other devices from making incorrect or malicious screen projections.
[0057] To facilitate better implementation of the device discovery method of this application, this application also provides an application processing apparatus based on the above-described device discovery method. The meanings of the terms used are the same as in the above-described device discovery method, and specific implementation details can be found in the descriptions of the method embodiments.
[0058] Please see Figure 5 , Figure 5 This is a schematic diagram of the device discovery apparatus provided in an embodiment of this application, wherein the device discovery apparatus is applied to a receiving device, and the device discovery apparatus may specifically be as follows: The receiving module 501 is used to receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device; The sending module 502 is used to control the response to the multicast query information according to the binding relationship with the sending end device, and obtain the response result.
[0059] Optionally, in some embodiments of this application, the response result includes either sending a unicast response to the multicast query information to the router device or not sending the unicast response information to the router device. The step of controlling the response to the multicast query information based on the binding relationship with the sending device, and obtaining the response result, includes: If the receiving device is bound to the sending device, a unicast response message for the multicast query message is sent to the router device, resulting in the router device sending a unicast response message for the multicast query message. The router device then forwards the unicast response message to the sending device. If the receiving device and the sending device are not bound together, then the unicast response information is not sent to the router device, resulting in the unicast response information not being sent to the router device.
[0060] Optionally, in some embodiments of this application, the multicast query information includes a first device discovery message based on SSDP or a second device discovery message based on mDNS.
[0061] Optionally, in some embodiments of this application, the method further includes: If a multicast announcement is detected, the router is prevented from sending the multicast announcement to the router device.
[0062] Optionally, in some embodiments of this application, the multicast announcement information includes a liveness announcement message based on SSDP or a query announcement message based on mDNS.
[0063] Optionally, in some embodiments of this application, the binding relationship is recorded on the receiving device; The receiving device establishes the binding relationship with the sending device by obtaining the identification information of the sending device; The identification information is carried in a QR code or a string.
[0064] Optionally, in some embodiments of this application, after the step of sending a unicast response to the multicast query information to the router device if the receiving device is bound to the sending device, and obtaining the result of sending a unicast response to the multicast query information to the router device, the method further includes: Receive a screen mirroring connection request forwarded by the router device, wherein the screen mirroring connection request is sent by the sending device to the router device; The router device sends a response to the screen mirroring connection request, and the router device forwards the response to the sending device.
[0065] In this embodiment, the receiving module 501 first receives multicast query information forwarded by the router device. The multicast query information is sent from the sending device to the router device. The sending module 502 controls the response to the multicast query information according to the binding relationship with the sending device, and obtains the response result.
[0066] In summary, this application embodiment controls whether the receiving device responds to multicast query information from the sending device through a binding relationship. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This achieves control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security.
[0067] In addition, this application also provides an electronic device, such as Figure 6 As shown, it illustrates a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Specifically: The electronic device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 601 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the electronic device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0068] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0069] The electronic device also includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power equipment debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0070] The electronic device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0071] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby implementing the steps in any of the device discovery methods provided in the embodiments of this application.
[0072] In this embodiment of the application, the receiving device receives multicast query information forwarded by the router device. The multicast query information is sent from the sending device to the router device. The receiving device controls the response to the multicast query information according to the binding relationship with the sending device, and obtains the response result.
[0073] In this embodiment, the binding relationship controls whether the receiving device responds to multicast query information from the sending device. This ensures that the receiving device does not respond to multicast query information sent by any device, meaning that the receiving device can only be discovered by devices that meet the binding relationship conditions. This allows control over the receiving devices that can be discovered by other devices. It avoids the receiving device appearing publicly open to all other devices, thus improving device privacy and security.
[0074] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0075] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0076] Therefore, this application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the device discovery methods provided in this application.
[0077] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0078] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0079] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the device discovery methods provided in this application, the beneficial effects that any of the device discovery methods provided in this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0080] The above provides a detailed description of a device discovery method, apparatus, electronic device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A device discovery method, characterized in that, Applied to a receiving device, the method includes: Receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device; The response to the multicast query information is controlled according to the binding relationship with the sending device, and the response result is obtained.
2. The device discovery method according to claim 1, characterized in that, The response result includes either sending a unicast response to the multicast query information to the router device or not sending the unicast response information to the router device. The step of controlling the response to the multicast query information based on the binding relationship with the sending device, and obtaining the response result, includes: If the receiving device is bound to the sending device, a unicast response message for the multicast query message is sent to the router device, resulting in the router device sending a unicast response message for the multicast query message. The router device then forwards the unicast response message to the sending device. If the receiving device and the sending device are not bound together, then the unicast response information is not sent to the router device, resulting in the unicast response information not being sent to the router device.
3. The device discovery method according to claim 1, characterized in that, The multicast query information includes a first device discovery message based on SSDP or a second device discovery message based on mDNS.
4. The device discovery method according to claim 1, characterized in that, The method further includes: If a multicast announcement is detected, the router is prevented from sending the multicast announcement to the router device.
5. The device discovery method according to claim 4, characterized in that, The multicast announcement information includes SSDP-based liveness announcement messages or mDNS-based query announcement messages.
6. The device discovery method according to claim 1, characterized in that, The binding relationship is recorded on the receiving device; The receiving device establishes the binding relationship with the sending device by obtaining the identification information of the sending device; The identification information is carried in a QR code or a string.
7. The device discovery method according to claim 2, characterized in that, If the receiving device and the sending device are bound together, the method further includes sending a unicast response to the multicast query information to the router device, and after obtaining the result of sending the unicast response to the multicast query information to the router device, the method further includes: Receive a screen mirroring connection request forwarded by the router device, wherein the screen mirroring connection request is sent by the sending device to the router device; The router device sends a response to the screen mirroring connection request, and the router device forwards the response to the sending device.
8. A device detection apparatus, characterized in that, Applied to a receiving device, the apparatus includes: The receiving module is used to receive multicast query information forwarded by the router device, wherein the multicast query information is sent from the sending device to the router device; The sending module is used to control the response to the multicast query information according to the binding relationship with the sending end device, and obtain the response result.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the device discovery method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the device discovery method as described in any one of claims 1-7.