Cocoa 中的文件共享发现
我正在尝试以编程方式发现并安装使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您所说的“低级 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 throughNSNetServiceBrowser
.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.