cl

David Grace

Bay Area, California

Programmer, SysAdmin, Artist

Of C#, SOAP, and UPnP

The problem with a geek mindset is that you are looking to solve problems which might have already been solved. It isn’t about fame or bragging rights (usually), but a deep desire to understand a system in thorough detail.

Past readers might be noticing a trend by now.

A few months ago, I was staying with a friend and wanted to host a game on my computer over their Wifi and cable modem connection. To do so, I needed ports opened through their router. As I did not want to bug my friend for admin level access, I checked to see if their Wifi router supported UPnP. It did!

If you are not familiar: UPnP is a SOAP protocol that most net-accessible devices implement which allows you the ability to query or control the state of said device. For routers, if UPnP is enabled you can set up temporary port forwards.

So I looked for a utility on the internet and found one that let do this. But I was curious about the UPnP protocol worked.

So, what is a geek to do? Write his own UPnP library, of course!

A lazy week later and I had Tuatara. It is a C# library for speaking the UPnP protocol. It comes with a basic WinForms UI program which lets you configure a UPnP-enabled router for IPv4 port forwarding.

The code is nothing too complicated. I isolated most of it as a separate library with the intention of creating an Android UI, but I never finished that part.

It lacks any form of useful testing, so use this code at your own risk. I also found that some models of Wifi routers do not respond to the UPnP requests in a way that are described in the protocol, and therefore break the program.

Configuration screen for the Tuatara WinForm program.

To check it out, go here: Tuatara on GitHub.