Introduction
Many applications support webinterfaces, either for controlling the application or for configuration. For example; most home routers have a config page, or a download/filesharing application like eMule has a full application web interface. How convenient they may seem, getting to those pages remains cumbersome.
Accessing a homerouter usually requires an ipconfig command at a command prompt to find the IP adres, which then can be used to point a browser to something like; http://123.123.123/. eMule uses a specific port to access it and hence requires a URL similar to http://123.123.123:12345/ to access it and if you use dynamic IP addresses it might change over time.
What if a user could just open the network, and find icons for all the devices/services available and access is just a click away? No requirements for putting shortcuts on all systems on the lan, nor a requirement for fixed IP addresses. This article will show how to achieve this by (ab)using the UPnP device protocol (on Windows that is, but it might work on other platforms to). Have a look at the screen shot below to see how its delivered.
The code in this article uses the Developer tools for UPnP (the former Intel UPnP stack).
Background
UPnP protocol supports automatic discovery using the SSDP protocol. Windows supports UPnP out of the box and just opening the network will automatically show all UPnP devices on the network (you might have to enable UPnP to have them shown).
UPnP devices generically provide some general details about the device and can (through the UPnP protocol) be queried for services they provide or sub-devices they embed. Once the device description (with the details and services) has been retrieved from the UPnP device, the services methods and properties can be accessed. For more info on the UPnP protocol check the documentation available at http://www.upnp.org/. The most common UPnP implementations are the mediaserver and mediarender devices, if you ever used WMP to browse media on another computer, or browsed your video collection on a NAS device from your TV, you've probably used UPnP already.
How to Make it Work
UPnP has standard devices for different purposes; media servers, media renderers and network gateways are the most commonly used. The most basic version of a UPnP device is the type called 'basic' (an appropriate name). It defines no services nor embedded devices and hence only the generic information. One of the generic items is the presentation page to access the device. Its not a required item, so many devices haven't implemented it. But in this case we'll use it to serve a simple piece of redirect html to the actual web-frontend that the user needs.
So what's happening now:
Read more: Codeproject
Many applications support webinterfaces, either for controlling the application or for configuration. For example; most home routers have a config page, or a download/filesharing application like eMule has a full application web interface. How convenient they may seem, getting to those pages remains cumbersome.
Accessing a homerouter usually requires an ipconfig command at a command prompt to find the IP adres, which then can be used to point a browser to something like; http://123.123.123/. eMule uses a specific port to access it and hence requires a URL similar to http://123.123.123:12345/ to access it and if you use dynamic IP addresses it might change over time.
What if a user could just open the network, and find icons for all the devices/services available and access is just a click away? No requirements for putting shortcuts on all systems on the lan, nor a requirement for fixed IP addresses. This article will show how to achieve this by (ab)using the UPnP device protocol (on Windows that is, but it might work on other platforms to). Have a look at the screen shot below to see how its delivered.
The code in this article uses the Developer tools for UPnP (the former Intel UPnP stack).
Background
UPnP protocol supports automatic discovery using the SSDP protocol. Windows supports UPnP out of the box and just opening the network will automatically show all UPnP devices on the network (you might have to enable UPnP to have them shown).
UPnP devices generically provide some general details about the device and can (through the UPnP protocol) be queried for services they provide or sub-devices they embed. Once the device description (with the details and services) has been retrieved from the UPnP device, the services methods and properties can be accessed. For more info on the UPnP protocol check the documentation available at http://www.upnp.org/. The most common UPnP implementations are the mediaserver and mediarender devices, if you ever used WMP to browse media on another computer, or browsed your video collection on a NAS device from your TV, you've probably used UPnP already.
How to Make it Work
UPnP has standard devices for different purposes; media servers, media renderers and network gateways are the most commonly used. The most basic version of a UPnP device is the type called 'basic' (an appropriate name). It defines no services nor embedded devices and hence only the generic information. One of the generic items is the presentation page to access the device. Its not a required item, so many devices haven't implemented it. But in this case we'll use it to serve a simple piece of redirect html to the actual web-frontend that the user needs.
So what's happening now:
- user opens the network
- under the heading 'Other devices' the device shows up
- user double clicks the icon
- Windows will open the link to the UPnP device (*) in the webbrowser
- the device page handler will return a html redirect page.
- the browser opens the actual web-frontend of your application, based on the redirect
Read more: Codeproject