Home > OS >  How bonjour discover devices on network?
How bonjour discover devices on network?

Time:08-12

I want to write a C program that can search Bonjour enabled devices on network.

Basically we have a Network IP Camera, it supports Bonjour protocol. I want to write API in C that can search these devices which have Bonjour enabled. Does anyone have sample code or suggestions on how should I do that?

CodePudding user response:

The following links provide some code samples, as you requested:

mDNSResponder

Quotes from mDNSPosix/ReadMe.txt:

mDNSPosix is a port of Apple's Multicast DNS and DNS Service Discovery code to Posix platforms.

Multicast DNS and DNS Service Discovery are technologies that allow you to register IP-based services and browse the network for those services.

Packing List:

The sample uses the following directories:

o mDNSCore -- A directory containing the core mDNS code. This code
is written in pure ANSI C and has proved to be very portable. Every platform needs this core protocol engine code.

o mDNSShared -- A directory containing useful code that's not core to the main protocol engine itself, but nonetheless useful, and used by
more than one (but not necessarily all) platforms.

o mDNSPosix -- The files that are specific to Posix platforms: Linux, Solaris, FreeBSD, NetBSD, OpenBSD, etc. This code will also work on
OS X, though that's not its primary purpose.

o Clients -- Example client code showing how to use the API to the
services provided by the daemon.

Using the Sample ---------------- When you compile, you will get:

o Main products for general-purpose use (e.g. on a desktop computer): - mdnsd - libmdns - nss_mdns (See nss_ReadMe.txt for important information about nss_mdns)

o Standalone products for dedicated devices (printer, network camera, etc.) - mDNSClientPosix - mDNSResponderPosix - mDNSProxyResponderPosix

o Testing and Debugging tools - dns-sd command-line tool (from the "Clients" folder) - mDNSNetMonitor - mDNSIdentify

SDWrap

ReadMe:

Quite simple wrapper app to execute some command with Zeroconf supplied addresses and ports. Uses wxWidgets and wxServDisc for service discovery...

Good luck!

  • Related