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?
Bonjour is a service discovery protocol that locates network devices such as computers and servers on your LAN. When this feature is enabled, the device periodically multicasts Bonjour service records to the LAN to advertise its existence.
Bonjour is Apple's implementation of Zero-configuration networking (Zeroconf), a group of technologies that includes service discovery, address assignment, and hostname resolution.
Step four: Check the AirPrint settings in the Embedded Web Server (EWS) AirPrint uses Bonjour, Apple's zero-configuration networking, to automatically discover the printer over the local wireless network.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With