<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>peekpoke : mws</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
</head>
<body>

<div id="header"><a href="/"><img id="logo" src="/peekpoke.png" 
alt="peekpoke" /></a></div>

<div id="menu">
S60 Mobile Web Server
</div>

<div id="content">
<h1>Bonjour for Mobile Web Server</h1>

<p>There's one big gotcha with mobile web servers; they frequently move into new networks (WLAN hotspots), but even though you are using the very same network yourself, you might not know
about the web server.  This problem can be solved with service discovery protocols, such as Bonjour (DNS-SD, mDNS) or UPnP.  These work by sending multicast UDP datagrams on the same subnet,
so that service discovery aware clients can connect to services.  Apple's Safari browser implements Bonjour based HTTP service discovery, and this is a demo how it works with MWS.

<p>This is a simple demo application which demonstrates local service discovery for Mobile Web Server.  It sends multicast dns-sd message to bonjour group address, containing entry similar to this: 
<pre>peekpoke._http._tcp IN SRV 10 100 80 www.peekpoke.fi. 
peekpoke._http._tcp IN TXT "path=/" 
</pre> 

<p> With some luck, this shows as a bonjour http service in safari, when the browser is running on 
the same subnet as server sending it (e.g. same WLAN router) <p> Originally, I had hoped to start service announce in apache boot, like this: 
<pre>PythonImport bonjour_announce main_interpreter 
</pre> 

<p>But for some reason, I couldn't make it to work on MWS although it works on regular Apache.  

<p>So, this application works by asking browser to refresh itself and on each request it sends the mdns packet. 

After installing, to start service discovery, open your (mobile - or any 
other, but then you have to use the public address) browser to 
http://127.0.0.1/mdns/index.py, select wlan access point (on the phone - 
this is used for the multicast, not browser connection), leave mobile 
browser running in background and watch the safari on pc/mac to detect the 
server.  You should automatically see MWS entry in the Bonjour bookmarks 
list:

<p />
<img src="mdns.png"/>

<p>This entry points to your own hostname in .mymobilesite.net.  It 
would be more efficient to use direct host IP, but unfortunately there 
is no simple way to retreive the local IP address of MWS (no local 
name, local address is 127.0.0.1 if request is coming from localhost 
etc)</p>


<h2>Download</h2>
<p><a href="mdns.sisx">
Application package
</a>
Installs itself to htdocs/mdns directory.  Install to same drive as MWS.  Source code included.
</p>

<h2>Further information</h2>

<p>More Multicast DNS, DNS Service Discovery and Bonjour related material 
can 
be found from <a 
href="http://developer.apple.com/networking/bonjour/index.html" 
target="_new">Apple's Bonjour pages</a>
</p>

<h2>Feedback</h2>
<p>any comments to jarnoh&#64;peekpoke.fi</a></p>
 </div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1585615-6";
urchinTracker();
</script>
</body>
</html>
