开发者

File sharing discovery in Cocoa

I'm tryi开发者_如何学Gong 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜