How to register a service using Mono.ZeroConf?

I am trying to check out a ZeroConf sample at http://www.mono-project.com/Mono.Zeroconf .

I am running OpenSuse 11 and Mono 2.2.

My server code:

using System; using Mono.Zeroconf; namespace zeroconftestserver { class MainClass { public static void Main(string[] args) { RegisterService service = new RegisterService (); service.Name = "test server"; service.RegType = "_daap._tcp"; service.ReplyDomain = "local."; service.Port = 6060; // TxtRecords are optional TxtRecord txt_record = new TxtRecord (); txt_record.Add ("Password", "false"); service.TxtRecord = txt_record; service.Register(); Console.WriteLine("Service registered!"); Console.ReadLine(); } } } 

But I can not find my registered service with a sample client browser code or with mzclient.

Thanks!

+5
c # mono zeroconf
source share
5 answers

I also tried using the binaries provided on the Mono.Zeroconf project page and creating libraries from the source for use on Windows and was unable to publish the service that was discovered by other clients. I tried both the sample code on the site and the one provided by MZClient.

After a little extra digging, I found a project that was used in the Mono.Zeroconf libraries. Using the binaries verified in the Growl project for Windows in Google Code (which seems to be the latest version 0.9.0), I was able to successfully publish the service I found with both sample code and MZClient.

Thus, the obvious work would be to grab the binaries (Mono.Zeroconf and Mono.Zeroconf.Providers.Bonjour) from this project and use them instead of those provided by the project.

+6
source share

The binaries at mono-project.com/Mono.Zeroconf are deprecated and still contain code that causes this problem. The latest code (with all corrections) is on this link, but you need to compile the code yourself.

+3
source share

I also failed to publish the service. I looked through the code and there is an error in Service.cs, the UPort installer:

 this.port = (ushort) IPAddress.HostToNetworkOrder((int) value); //overflow, port is always 0 

It should be

 this.port = (ushort) IPAddress.HostToNetworkOrder((short) value); 
+2
source share

It uses mzclient to test its Mono.Zeroconf code above. The whole point of Mono.Zeroconf is to provide cross-platform support for several mDNS providers (Avahi and Bonjour).

It seems that the problem is with the Avusi EntryGroup DBus API, and I am viewing it in Mono.Zeroconf. I will post the solution here and also make a new release of Mono.Zeroconf (I am the project developer) when I find out the problem.

+1
source share

Re-compiling after updating the source from the following link solved the problem

https://github.com/mono/Mono.Zeroconf/tree/master/src

+1
source share

All Articles