Zeroconf Name resolution

2019-04-07 07:03发布

I am developing a control device with an embedded webserver. The webserver provides a control interface to any web browser that requests it (from Windows browsers, Mac browsers, iPhone android etc).

The problem I am having is with a general way of generically knowing how to access the device. i.e. what address to type in the web browser.

Fixed IPs are too techie for my users and could go wrong as my device could be plugged into many different Local networks. Using uPnp service discovery requires software to run on the client for some platforms and isn't as natural as just typing a web address. I want to implement Name Resolution.

My current implementation uses the netbios protocol. So from a windows browser I can type //controller/ and it works but this doesn't work with Macs or smartphones. I can in addition try to implement Apples mDnsresponder which should make Macs and iPhones play happy (although i think then im limited to //controller.local/). Maybe similar things exist for Android, Symbian etc too but is there not a more universal solution for creating one network name that I could try?

The platform is currently based on a TI Cortex M3 processor and lwIP.

Any help or suggestions for how to find a solution are much appreciated.

Kind Regards,

Bob

2条回答
我只想做你的唯一
2楼-- · 2019-04-07 07:29

For Windows users to be able to 'automagically' find your device using Zeroconf, they would need to:

  1. Have an mDNS daemon installed (like the mDNSResponder you mentioned, which is available for free from Apple)
  2. Have a second piece of software installed that knows how to issue queries to the mDNS daemon and display available services on the local network (i.e., your device's embedded web server)

Bonjour for Windows comes bundled with an Internet Explorer plugin that's adequate for item #2, and might not be 'too techie' for your users. (They would just need to download and install Bonjour for Windows and tick the box to install the Internet Explorer plugin.) Mac users could just use the Safari browser, which is already Zeroconf-aware.

The final piece of the puzzle---and the trickiest part---is that you would have to modify your own software to register your controller with the "local mDNS daemon". However, there's no such thing, presumably, because your 'control device' is an embedded system. So you'd need to write your own bare-bones mDNS daemon. It's not that hard to do, and you can use Apple's mDNSPosix code as a starting point. But, depending on your hardware constraints, this might not be feasible.

All in all, Zeroconf can be a tricky stack of protocols to work with. The 'zero configuration' aspect applies only to the user's experience. To a developer, it presents a fairly steep learning curve. If your users typically only have a single instance of your device running, it may be overkill.

查看更多
在下西门庆
3楼-- · 2019-04-07 07:44

I think you can use DynDns (www.dyndns.org), it's free for what you are trying to do. You can use it even if you have no possibility of getting a fixed ip-address. In that case you would use the dyndns updater utility. You could e.g. register ourCompanyName.dyndns.org and it will always get routed to your local computer.

查看更多
登录 后发表回答