Hikvision_Camera search tool

The camera sends broadcasts using mdns

mDNS : multicast DNS, canonical document address:  http://www.ietf.org/rfc/rfc6762.txt .

In the LAN, you need to communicate with other hosts through one host, you need to know the IP address of the other party, but sometimes, you do not know the IP address of the other party, because generally in the LAN that uses DHCP to dynamically assign IP addresses, each The host's IP address is assigned to you by a DHCP server. So in many cases, it is more troublesome for you to know the IP address of the other party.

In view of the fact that this article has been viewed more recently, and it has been reprinted a lot at night, I would like to declare that the level of the article may not be enough, but it is just my understanding at the time, so I hope everyone can look at it from a critical point of view, and then what is the problem? Discussions are welcome. I really don't want to mislead you ^_^

How mDNS works

First, some reserved addresses are specified in the IP protocol, one of which is 224.0.0.251, and the corresponding IPv6 address is [FF02::FB].

The mDNS protocol specifies a port, 5353.

mDNS is based on the UDP protocol.

Each host entering the LAN, if the mDNS service is enabled, will multicast a message to all hosts in the LAN, who am I, and what is my IP address. Then other hosts that also have the service will respond and tell you who it is and what its IP address is. Of course, the specific implementation is more complicated than this.

For example, host A enters the LAN, enables the mDNS service, and registers the following information with the mDNS service: I provide FTP service, my IP is 192.168.1.101, and the port is 21. When host B enters the LAN and requests the mDNS service of host B, I want to find the FTP server in the LAN, and the mDNS of host B will go to the LAN to ask other mDNS, and finally tell you that there is an IP address 192.168.1.101 , the host whose port number is 21, that is, host A provides FTP service, so host B knows the IP address and port number of host A.

The general principle is like this. mDNS provides far more services than this. Of course, there are many services but not complicated.

This service is provided on Apple's devices (computers, notebooks, iphones, ipads, etc.). Many Linux devices also provide this service. Windows devices may not provide this service, but if you have software such as iTunes installed, this service is also provided.

In this way, you can use this service to develop some automatic discovery in the local area network, and then provide some interactive applications in the local area network.

jmDNS is a JAVA platform that provides a third-party library for mDNS services. After this jar package is introduced into the Android project, the mDNS service can be obtained. After Android 3.x or 4.x, the API for automatic discovery in the local area network has been provided, so it can be achieved without using the jmDNS third-party library.

Below are instructions from  http://www.multicastdns.org/  .

Multicast DNS is a way of using familiar DNS programming interfaces, packet formats and operating semantics, in a small network where no conventional DNS server has been installed.
Multicast DNS is a joint effort by participants of the IETF Zero Configuration Networking (zeroconf) and DNS Extensions (dnsext) working groups. The requirements are driven by the Zeroconf working group; the implementation details are a chartered work item for the DNSEXT group. Most of the people working on mDNS are active participants of both working groups.
While the requirements for Zeroconf name resolution could be met by designing an entirely new protocol, it is better to provide this functionality by making minimal changes to the current standard DNS protocol. This saves application programmers from having to learn new APIs, and saves application programmers from having to write application code two different ways — one way for large configured networks and a different way for small Zeroconf networks. It means that most current applications need no changes at all to work correctly using mDNS in a Zeroconf network. It also means that engineers do not have to learn an entirely new protocol, and current network packet capture tools can already decode and display DNS packets, so they do not have to be updated to understand new packet formats.

--- EOF ---


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325485156&siteId=291194637