Re: Cocoa (or any Mac API) "browse for computer" dialog
Re: Cocoa (or any Mac API) "browse for computer" dialog
- Subject: Re: Cocoa (or any Mac API) "browse for computer" dialog
- From: Andrew Satori <email@hidden>
- Date: Fri, 09 May 2014 14:12:14 -0400
You probably won't find this terribly helpful either but here goes.
On May 9, 2014, at 1:33 PM, Dan Korn <email@hidden> wrote:
> I appreciate all the responses, but unfortunately I’m not finding them helpful.
>
> On May 8, 2014, at 11:27 PM, Chris Hanson <email@hidden> wrote:
>> Note that you don’t browse for computers on a network; rather, you browse for services on a network. Only computers offering the service for which you’re browsing will show up — and really, what use are computers to your users that aren’t offering the service? :)
>
> That may be how you think my application should work, but in fact, I (my users) actually DO browse for computers on a network. They need to locate a machine on the LAN that’s running a particular Windows service which is listening on a TCP socket port. There’s no “advertising” of the service, and I don’t really want to go trying to connect to the service on every machine on the LAN in turn. And adding some kind of Bonjour service to the hundreds of existing installations of our service on customers’ servers is a non-starter.
>
> Obviously not every machine on the network is running the service to which the user wants to connect from the client app, but at least presenting a list of machines on the LAN gives users something to choose from, so that they have a bit of assistance in locating the server, instead of having to manually type in the machine name, with the correct spelling, or an IP address. This is a very useful feature of the client app on Windows, and users rightly complain that the Mac version does not offer this feature. Why can’t our Mac users have this same functionality? I realize that a Mac doesn’t have the same concept of being on a domain that a Windows machine does, but it is on a LAN, and it does see all those other computers.
The model you are working with is one where you are showing a convenience dialog that list all servers, but presumes that the user knows which server has the service running already. Short version, the equivalent dialog from the Windows world doesn't exist (and arguably, nor should it). For example, in Finder, hit Option+K and the hit browse, you get the finder window for network servers, which only show servers that are advertising either AFP, or CIFS/SMB file services. In your case, you are dealing with Windows servers, that expose your service (they do not necessarily publish File Services, so they might not show up in the browser anyway, the same is true in Windows FWIW.
With that in mind, you need to be browsing the CIFS servers on the network, which isn't all that hard since CIFS is a chatty as hell protocol anyways, though it is better in SMB2, which is now the default in Mavericks. In order to do that, you get to wade deep into the bowels of using the SMB2 API to do your discover of the servers on your network (that are actively broadcasting NETBIOS) and then figure out how to present them to the user.
In short, you can get where you want, that is, implementing a convenience to work around a curious UX design, or you can figure out a proper way to to the scan yourself.
Personally, I'd be looking at something a little 'smarter' to only show valid servers, not every machine on a network segment that happens to have CIFS, AFP, or other supported browsable file sharing protocol turned on, which may or may not actually include the service I am looking for.
>> I recommend the “NSNetServices and CFNetServices Programming Guide” at <https://developer.apple.com/library/mac/documentation/Networking/Conceptual/NSNetServiceProgGuide/Introduction.html> as a good starting point; the classes are very easy to use.
>
> Yes, I’ve looked at that. Regardless of how easy the classes are to use, what it doesn’t tell me is what magic service code I need to use to get the same list of machines that the Finder shows. I can issue commands in the Terminal like "dns-sd -B _smb”, but it doesn’t even list all the Samba machines on the network, even ones I’m currently connected to via Samba. There’s a handy “Bonjour Browser” app that I found, but even that doesn’t show all the machines that the Finder does.
Nor will it (for all of the reasons mentinoed above).
> So, using Bonjour, what is/are the service code/codes for “all machines on the network,” as seen by the Finder?
There isn't one, because, not all SMB/CIFS/AFP solutions implement Bonjour, so they are being discovered using other means. In the case of Finder, probably SMB2 NetBIOS discovery that really doesn't make sense in a broader sense.
> Can anyone actually answer my question: Is it possible to just present the same list of computers that the Finder shows in a dialog in my app
No. It is not a system provided dialog. You do not have a 1 to 1 mapping of dialogs from Windows OS X. To get what you think you want will require some custom code and digging into some unfriendly territory.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden