The demo should consist of a remotely controllable light. For the purpose of this demo the light will be a mockup. The light will be on the same machine that HomeOS is running on, and will be visible remotely through a USB webcam.
This demo should appear very similar to the previous demo. Dynamic DNS is enabled and HomeOS will be contacted using this human readable address rather than a dotted-quad. It wasn't until Tuesday night before the milestone that I discovered my NAT traversal wasn't going to work, so I will most likely not have the relay server operational for this milestone.
Dynamic DNS has the ability to solve the problem of a user being assigned a public IP by their ISP that is not static. A well known provider of this service is DynDNS. The way it works is:
This takes care of the problem of a changing public IP address on a network, but unfortunately does nothing to help with NAT. This can also be used by a cell phone, but in this case it might not be as useful since you will often be on a network where you don't have control of port forwarding.
A STUN Server has the ability to enable NAT traversal with some routers. To test the feasibility of this as a solution for my router I implemented a simple STUN Server, a dummy HomeOS, and a test client.
The various pieces interacted in the following manner:
Unfortunately (or perhaps fortunately for security's sake), my router's firewall considered a reply coming from someone other than the recipient of the initial message to be an attack. Because of this, even if the NAT traversal was successful, the router would still require modification to bypass the firewall. As such, and because of time limitations, I am abandoning this approach in favor of a relay server.
HomeOS and WP7 communicate over HTTP which is layered above TCP. Punching a hole in the NAT using UDP is supposed to be fairly effective and reliable; however, it is much less reliable over a TCP connection. Often this depends on the router and how "well behaved" it is. Switching the communications to use UDP does not seem to be an option, since WP7 does not yet support socket connections. Furthermore, this would require an extensive reworking of the existing structure.
At this point the most reasonable options seem to be:
For any of the more complex methods it seems that using the cloud relay service would be a good fallback method. Because of this I will attempt to implement the relay method first. I can then try and improve performance using another method.
Using a relay server for all communication between HomeOS and WP7 is probably the most straightforward and easy to implement. I will use this method first and expand on it given time. This should ensure a working product even if I lack sufficient time to implement a more sophisticated method.