7

I'm currently working on a cross-platform application (Win/OSX/iOS) which has a C++ (with Boost) back end. On iOS and OSX I'm using the Cocoa Net Service Browser Delegate functions to discover an embedded device via mDNS, then pass the information to the back end to create the objects it needs to communicate with it.

I wanted to take a similar approach with my Windows MFC front end and I found this article which seemed to do exactly what I want. However, it seems that using the Bonjour SDK has some really nasty side effects - forcing you to static link to MFC and in my case the only way I can get it to link properly is to not use debug DLLs at all, which is not ideal.

So, the Bonjour SDK isn't really any good for me because it imposes too many restrictions on my project. With Cocoa I'm actually using very little of the functionality - just didFindService and netServiceDidResolveAddress really. All I want to do is find the devices of a given type and get their IP addresses.

Can anyone suggest another way around this that will work with an MFC front end on Windows?

Redeye
  • 1,582
  • 1
  • 14
  • 22

1 Answers1

8

From what I have been able to gather from researching this topic just goto http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-333.10/ and grab the source. There is a VC project file which will let you build the dll how you want.

James Marjie
  • 96
  • 1
  • 2
  • Thanks, that's pretty much what I ended up doing. I've built the DLL from source and linked to that instead of the system DLL. It's not ideal because I'll have to ship my compiled DLL with the product, but it does avoid having to make sure Bonjour is already installed. It's a real shame - this is so straightforward on OSX and iOS. – Redeye Apr 19 '12 at 08:19
  • I would expect things to get better in the next 6 months or so. It looks like apple is tooling to make iTunes less of a Frankenstein and pulling out code for syncing etc and pushing to iCloud. Which should me a code clean up, hopefully. – James Marjie Apr 22 '12 at 23:15
  • 3
    Note that the tarballs are available here: http://www.opensource.apple.com/tarballs/mDNSResponder/ – Patrick Jun 03 '13 at 22:14
  • Hey, guys! I realize this is really old, but I have stupid question: if you compile dll yourself, you still rely on bonjour service to be installed, right? – Shchvova Aug 15 '16 at 20:37
  • 2
    @Shchvova really old back at you! Yeah, you still need the Bonjour service. – nelsonjchen May 09 '19 at 04:05
  • I've hooked up an Azure Pipeline setup to one of the mDNSReponder repositories on GitHub. It builds the stub `.lib`, just like the one in the Bonjour SDK. I don't know if it would have satisified the OP's requirements but it continuously builds and deploys! https://github.com/nelsonjchen/mDNSResponder – nelsonjchen May 09 '19 at 04:09
  • @Patrick You da real MVP – user614273 Oct 22 '22 at 23:24