How to advertise a Bonjour Service in Visual C++

2019-06-18 15:52发布

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++?

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-06-18 16:11

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/

查看更多
虎瘦雄心在
3楼-- · 2019-06-18 16:23

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

查看更多
登录 后发表回答