问题
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.
回答1:
Bonjour (mDNS) is a good solution and there are stable libraries for Mac, Windows and Linux.
- OS X- Check out the documentation for NSNetService
- Windows- I'd use the Apple Bonjour SDK for Windows or the jMDNS library if you're developing a Java app.
- 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.
回答2:
I think what you are looking for is Zero configuration networking, it is a technical specification that is not bound to any vendor. Bonjour from Apple and UPnP SSDP from Microsoft are different implementation of Zero configuration networking. Generally speaking, it allows you announce/discovery network service with zero network configuration. If you are with Java, there are already some frameworks that makes your life easier JmDNS and Cling.
来源:https://stackoverflow.com/questions/6935212/how-to-publish-file-server-service-to-local-network