Using Apple’s Bonjour service from .NET?

Posted by Martín Marconcini on Stack Overflow See other posts from Stack Overflow or by Martín Marconcini
Published on 2010-04-29T17:07:36Z Indexed on 2010/04/30 3:57 UTC
Read the original article Hit count: 526

Filed under:
|
|

I have an iPhone app that publishes through Bonjour. The Mac counterpart works, they sync and exchange data. Now I have to port that little Mac app to Windows. I’ve decided to go with .NET (because that’s what I know).

The app is not complex, but I’m in the early stages. I need to browse/discover Bonjour services. For this task, I’ve downloaded Mono.Zeroconf and Apple’s latest SDK (which includes a couple of C# Samples).

I’m not really pasting code because I’m really copy/pasting the samples. In fact, Mono.Zeroconf has a MZClient.exe that can be used to test “all the API”.

My 1st test was -on the same box- open two cmd.exe and launch a MZclient registering a service and on the other, launch it and “discover it”.

It doesn’t work.

Here’s the server:

C:\MZ>MZClient -v -p "_http._tcp 80 mysimpleweb”

*** Registering name = 'mysimpleweb', type = '_http._tcp', domain = 'local.'
*** Registered name = ‘mysimpleweb’

On the other terminal:

c:\MZ>MZClient -v -t "_http._tcp"
Creating a ServiceBrowser with the following settings:
  Interface         = 0 (All)
  Address Protocol  = Any
  Domain            = local
  Registration Type = _http._tcp
  Resolve Shares    = False

Hit ^C when you're bored waiting for responses.

And that’s it. Nothing happens. I’ve of course tried with different services to no avail. Even played a little bit with that domain thing. Remember this is the same box. I tried on another computer, because this was a VM inside OSX, so I went ahead and tried on a “pure” win XP. Nothing.

note: I have Apple Bonjour Service (up and running) and also the Apple SDK (installed later).

Given that this didn’t work, I went ahead and decided to try the Apple SDK which has an Interop and a few pre-compiled samples (and its source code).

Short story, neither the mDSNBrowser.exe nor the SimpleChat.exe work/see/discover anything.

My box is a Win7 under Parallels, but that doesn’t seem to be affecting anything, given that the native XP exhibits the same problems.

What am I doing so awfully wrong?

© Stack Overflow or respective owner

Related posts about bonjour

Related posts about .NET