Just as a reference (should it help in your development), there's a C# uPnP library here. There's also a c# BitTorrent library here.

And both of them run under Mono, meaning Windows, MacOS and Linux support.