Search code examples
bonjourupnpnetwork-drive

How to publish file server service to local network?


My question is about "automatic discovery of file server service on local network".

I want to implement a service which is file server basically and publish it on local network. Client PC which is connected to local network should find this service automatically and map (mount) network drive without user's intervention.

As I look through web shortly, I think "Bonjour" for Apple and "UPnP" for Windows is best option to implement this kind of feature.

Is this right assumption? Do you know any other good suggestion? How about Linux?

UPDATE: FYI - I finished my zero-configuration SW implementation on Linux by using Avahi for Mac OS X network and PnP-X for Windows network. You can find PnP-X sample codes at here. Also, see my another question for PnP-X.


Solution

  • Bonjour (mDNS) is a good solution and there are stable libraries for Mac, Windows and Linux.

    1. OS X- Check out the documentation for NSNetService
    2. Windows- I'd use the Apple Bonjour SDK for Windows or the jMDNS library if you're developing a Java app.
    3. Linux- The Avahi APIs are probably the easiest to integrate.

    Apple has open-sourced its reference mDNS implementation and getting it to compile on most platforms is pretty trivial. There are also wrappers for many scripting languages, for example Net::MDNS for ruby.