3

I'm trying to make a simple concept demonstration app the code of which I may use in the future. Specifically I want to have an iPhone running an app that sends XML data to a Bonjour service. I already have an Objective-C app that runs on mac and does this, but I need to make one on Windows with a strong preference for Mono Zeroconf because the project may involve the use of the Mono framework later on.

To this end I need a working sample of using the Mono Zeroconf library. The examples I could find on the website are not sufficient. ALl that they allow me to do is to register a service, but nothing after that. Specifically I have this:

RegisterService service = new RegisterService();
service.Name = "AirControlServer";
service.RegType = "_http.tcp.";
service.ReplyDomain = "local.";
service.Port = 3689;
service.Register();

And now I have absolutely no clue what to do. If someone could link me to some sample code or something, that would be really nice.

Thank you.

RedHack
  • 285
  • 7
  • 18

2 Answers2

2

The Zeroconf is only used for announcing or discovering. That is, if you have some kind of service (for example, http server), you can use Mono.Zeroconf to announce it. The provided service is beyond the scope of the library, you have to provide it as usual. In other words, you can use the library to either answer questions like "What is the IP address of my service provider?" or announce such services ("Tell them that X.X.X.X has a service on port YY).

For the announcing part, you've already found the example, you can also look at this question. For the discovering, look here (at the "Listen for and resolve services" part).

Community
  • 1
  • 1
konrad.kruczynski
  • 46,413
  • 6
  • 36
  • 47
1

In the Mono.Zeroconf source code, there is a sub-directory MZClient which contains good example code ZeroconfClient.cs for both publishing and browsing.

Craig McQueen
  • 41,871
  • 30
  • 130
  • 181