如何向 Mono.ZeroConf 注册服务?

发布于 2024-07-14 07:05:49 字数 988 浏览 8 评论 0原文

我正在尝试在 http://www.mono-project.com/Mono 测试 ZeroConf 示例.Zeroconf

我正在运行 OpenSuse 11 和 Mono 2.2。

我的服务器代码是:

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();
        }
    }
}

但我无法使用示例客户端浏览器代码或 mzclient 找到我注册的服务。

谢谢!

I'm trying to test the ZeroConf sample at http://www.mono-project.com/Mono.Zeroconf.

I'm running OpenSuse 11 and Mono 2.2.

My server code is:

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't find my registered service with the sample client browser code nor with mzclient.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

顾挽 2024-07-21 07:05:49

我还尝试使用 Mono.Zeroconf 项目页面提供的二进制文件并构建源中的库无法在 Windows 上使用,并且无法发布其他客户端可以找到的服务。 我尝试了网站上的示例代码和提供的 MZClient。

经过更多挖掘后,我发现了一个用于 Mono.Zeroconf 库的项目。 使用签入 Google 代码中的 Growl for Windows 项目的二进制文件(该项目似乎是最新版本 0.9.0)我能够使用示例代码和 MZClient 成功发布可查找的服务。

因此,一个明显的解决方法是从该项目中获取二进制文件(Mono.Zeroconf 和 Mono.Zeroconf.Providers.Bonjour)并使用它们而不是项目提供的二进制文件。

I've also tried to use the binaries provided at the Mono.Zeroconf project page and building the libs from source for use on Windows and was unable to publish a service that was findable by other clients. I tried both the example code on the site and the MZClient provided.

After a little more digging I found a project that used to the Mono.Zeroconf libs. By using the binaries checked into the Growl for Windows project at Google Code (which appear to be the latest version 0.9.0) I was able to successfully publish a findable service with both the sample code and MZClient.

So an apparent work around would be to grab the binaries (Mono.Zeroconf and Mono.Zeroconf.Providers.Bonjour) from that project and use those instead of the ones provided by the project.

云归处 2024-07-21 07:05:49

mono-project.com/Mono.Zeroconf 上的二进制文件已过时,并且仍然包含导致此问题的代码。 最新的代码(包含所有修复)位于此链接
但需要你自己编译代码。

The binaries at mono-project.com/Mono.Zeroconf are out of date and still contain code that causes this problem. The most recent code (with all the fixes) is at this link
but require you to compile the code yourself.

溇涏 2024-07-21 07:05:49

我也无法发布服务。 我查看了代码,发现 UPort 设置器 Service.cs 中有一个错误:

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

它应该是

this.port = (ushort) IPAddress.HostToNetworkOrder((short) value);

I wasn't able to get a service published either. I looked through the code and there is a bug in Service.cs, the UPort setter:

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

It should be

this.port = (ushort) IPAddress.HostToNetworkOrder((short) value);
烟若柳尘 2024-07-21 07:05:49

从以下链接更新源代码后重新编译解决了问题

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

Recompiling after updating the source from the following link solved the issue

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

梦情居士 2024-07-21 07:05:49

他正在使用 mzclient 来测试上面的 Mono.Zeroconf 代码。 Mono.Zeroconf 的全部要点是提供跨平台、多个 mDNS 提供商支持(Avahi 和 Bonjour)。

EntryGroup DBus Avahi API 似乎存在问题,我正在 Mono.Zeroconf 中进行调查。 当我解决这个问题时,我将在这里发布一个解决方案,并发布一个新的 Mono.Zeroconf 版本(我是该项目的维护者)。

He is using mzclient to test his Mono.Zeroconf code above. The entire point of Mono.Zeroconf is to provide cross platform, multiple mDNS provider support (Avahi and Bonjour).

There appears to be an issue with the EntryGroup DBus Avahi API and I am looking into it in Mono.Zeroconf. I'll post a solution here, as well as make a new Mono.Zeroconf release (I am the maintainer of the project) when I figure out the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文