问题
I'm trying to figure out if this is even possible, but what's the simplest way of advertising a Bonjour service through Visual C++?
回答1:
You can use the DNS Service Discovery client: dns-sd.
Windows Bonjour Installer puts it in C:\Windows\system32\dns-sd.exe
Its synopsis is:
dns-sd -R name type domain port [key=value ...]
dns-sd -B type domain
dns-sd -L name type domain
There isn't any easy way to find indepth Bonjour windows documentation, (and it's a serious shame) but here's the manpage for its mac equivalent:
http://developer.apple.com/.../dns-sd.1.html
There is also C:\Windows\system32\dnssd.dll
whose API, I unfortunately have to suppose, conforms to this document:
http://developer.apple.com/.../dns_sd_h/
回答2:
This is rather old question... however as I had recently implemented Bonjour functionality in Windows for one project, have some insight into it. There is a Bonjour SDK for Windows from Apple developer site with examples in C, C#, etc. In C examples folder there is a complete source for dns-sd client which you can then use to build your own client (for registering services, names, etc.). As that is C, you can then easily pack this functionality as dll and then allow and other languages to use it (for example, C#).
Bonjour SDK for Windows @ developer.apple.com
来源:https://stackoverflow.com/questions/3463218/how-to-advertise-a-bonjour-service-in-visual-c