使用来自 .NET 的 Apple Bonjour 服务?

发布于 2024-08-30 23:36:13 字数 1322 浏览 3 评论 0原文

我有一个通过 Bonjour 发布的 iPhone 应用程序。 Mac 的对应部分可以工作,它们同步和交换数据。现在我必须将这个 Mac 小应用程序移植到 Windows。我决定使用.NET(因为我就知道)。

该应用程序并不复杂,但我还处于早期阶段。我需要浏览/发现 Bonjour 服务。对于此任务,我下载了 Mono.Zeroconf 和 A​​pple 最新的 SDK(其中包括几个 C# 示例)。

我并不是真正粘贴代码,因为我实际上是复制/粘贴示例。事实上,Mono.Zeroconf 有一个 MZClient.exe,可以用来测试“所有 API”。

我的第一个测试是在同一个盒子上打开两个 cmd.exe 并启动一个注册服务的 MZclient,在另一个上启动它并“发现它”。

这不起作用。

这是服务器:

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

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

在另一个终端上:

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.

就是这样。什么也没发生。我当然尝试过不同的服务但​​无济于事。甚至还玩了一下那个领域的东西。请记住这是同一个盒子。我在另一台计算机上进行了尝试,因为这是 OSX 内的虚拟机,所以我继续尝试在“纯”win XP 上进行。没有什么。

注意:我有 Apple Bonjour 服务(已启动并正在运行)以及 Apple SDK(稍后安装)。

鉴于这不起作用,我决定尝试 Apple SDK,它具有互操作性和一些预编译示例(及其源代码)。

简而言之,mDSNBrowser.exe 和 SimpleChat.exe 都无法工作/查看/发现任何内容。

我的机器是Parallels下的Win7,但这似乎没有影响任何事情,因为本机XP也出现了同样的问题。

我到底做错了什么?

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?

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

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

发布评论

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

评论(2

我最亲爱的 2024-09-06 23:36:13

我在 .NET 内部使用了 Zeroconf NetServices for Zeroconf。假设您允许 Bonjour 通过防火墙并且您的网络硬件允许多播,则最大的问题始终是 Apple Bonjour 服务的不可靠性。常规工作代码会失败,解决方案是重新启动 Bonjour 服务。因此,请检查您的网络硬件,检查您的防火墙,但最终重新启动 Bonjour 几次。它并不总是在第一次、第二次或第三次尝试时有效。

I've used Zeroconf NetServices for Zeroconf inside of .NET. Assuming that you allow Bonjour through your firewall and that your network hardware allows multicast, the biggest issue always was the unreliability of the Apple Bonjour service. Routinely working code would fail, with the solution being to restart the Bonjour service. So, check your network hardware, check your firewall, but ultimately restart Bonjour a few times. It doesn't always work on the first, or second, or third try, etc.

朦胧时间 2024-09-06 23:36:13

这里有一些重要的参考,因为 NuGet 版本、Git 中的源版本和 Growl Windows 下载目前似乎都有稍微不同的实现。 NuGet 包不适合我,因此我下载了源代码,进行了建议的更改并重新编译。

如何向 Mono.ZeroConf 注册服务?

http://bryanprice.info/2011/01/29/mono-zeroconf -在Windows上/

Here are a couple of important references as the NuGet version, source version in Git and Growl Windows download currently seem to all have slightly different implementations. The NuGet pack didn't work for me, so I downloaded the source, made the recommended changes and recompiled.

How to register a service with Mono.ZeroConf?

http://bryanprice.info/2011/01/29/mono-zeroconf-on-windows/

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