Cocoa 中的文件共享发现

发布于 2024-08-21 23:52:57 字数 335 浏览 3 评论 0原文

我正在尝试以编程方式发现并安装使用 OS X 的 Cocoa 应用程序文件共享共享的网络卷。我正在使用 NSNetServiceBrowser 来发现哪些服务器正在广告文件共享 - 很简单。

我的问题是关于下一步 - 如何发现给定机器可用的共享? IE。鉴于 AFP URL 看起来像这样:

afp://SomeMac._afpovertcp._tcp.local/SomeVolume
afp://SomeMac._afpovertcp._tcp.local/OtherVolume

我如何发现组成最后一个 url 组件的共享名称?当然,我不必为此向法新社发出低级呼吁!

I'm trying to programmatically discover and then mount network volumes shared using OS X's file sharing from a Cocoa app. I'm using NSNetServiceBrowser to discover which servers are advertising file sharing - easy enough.

My question is about the next step - how do you discover what shares are available for a given machine? ie. given that AFP URLs look something like this:

afp://SomeMac._afpovertcp._tcp.local/SomeVolume
afp://SomeMac._afpovertcp._tcp.local/OtherVolume

how do I discover the share names that make up that last url component? Surely I don't have to make low-level AFP calls for this!

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

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

发布评论

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

评论(1

是伱的 2024-08-28 23:52:57

如果您所说的“低级 AFP 调用”是指 FPGetSrvrParms(),那么几乎可以肯定这正是您需要执行的操作。 Bonjour (NSNetServiceBrowser) 旨在发现服务,而不是执行特定于服务的通信。法新社就是这项服务。每个卷都不是自己的服务,就像您期望通过 NSNetServiceBrowser 访问各个 HTTP URL 一样。

我不相信法新社有 Cocoa 界面。 Bill Monk 写了一些简单的安装代码 您可能会发现有用。

If by "low-level AFP calls" you mean FPGetSrvrParms(), then almost certainly that's exactly what you would need to do. Bonjour (NSNetServiceBrowser) is intended to discover services, not perform service-specific communications. AFP is the service. Each volume is not its own service any more than you would expect to access individual HTTP URLs through NSNetServiceBrowser.

I don't believe there's a Cocoa interface to AFP. Bill Monk wrote up some simple code for mounting that you might find useful.

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