[AoyW] Talking to the Web Server that Just Walked In
A peripatetic web server can't just tack up a sign on the nearest wall reading, "Hey, I'm the cool new site in this room! My IP of the moment is 192.168.0.101." So how do you talk to the web server running on your wi-fi handheld using a friend's laptop at the coffee shop? It's a case of "Don't call us, we'll call you—often".
A wandering web server has to sing "here-i-am" periodically on the local network. Potential clients have to listen for that tune, which will come across on an agreed port. However, contemporary browsers aren't prepared to listen for anything except responses to requests they've posted to known servers.
Fortunately, the solution is trivial. All we need is a faceless desktop app, with an icon by the taskbar clock, that tunes in that port, taking down the info for any web server that chants. When you want to talk to one of them, you click the icon to view the list of singing servers, and hit the one you aim to chat up. That starts a browser for the server in question.
Our current airWRX prototype uses this technique inside its client component, though now I wish we'd separated it out as described above, so anyone could grab and reuse it in their own projects. (That wouldn't be much work, so if interested, drop an email to airWRX->networkimprov+net.) The server singer can be implemented in a one-line pearl script, or a brief C program that runs from the command prompt or in its own thread in a larger app.
You'd think that this scheme would already be specified somewhere, for instance Apple's Bonjour protocols for ad hoc IP networking. But as far as I can tell, it assumes that services are lethargic beasts, whereas clients flit about; the fleas must seek the dogs. In the case of a web server running on your laptop or wi-fi handheld, it's the ephemeral animal. If clients constantly call "are-you-there" looking for newly arrived or departed servers, a room full of clients would waste a lot of the available bandwidth. It's more logical to have the servers do the talking.