views:

5439

answers:

4

I'm working on a P2P application, and I need to get it to communicate through NAT Routers / Firewalls using UPnP. However, it doesn't seem that the .NET Framework includes support for UPnP.

Is there a UPnP Library for .NET? C# or VB.NET?

UPDATE: I have since found the NATUPnP 1.0 Type Library (NATUPNP.DLL) COM Component that is part of Windows (since Windows XP) that allows you to easily setup/maintain Port Forwarding using UPnP.

I wrote an article with code samples here: .NET Framework: Communicate through NAT Router via UPnP (Universal Plug and Play)

+5  A: 

There is a COM library that's easy enough to access:

UPnP APIs Purpose

The UPnP™ framework enables dynamic networking of intelligent appliances, wireless devices, and PCs. There are two APIs for working with UPnP-certified devices:

The Control Point API, which consists of a set of COM interfaces used to find and control devices. The Device Host API, which consists of a set of COM interfaces used to implement devices that are hosted by a computer.

Frank Krueger
I wrote an article with code samples here: .NET Framework: Communicate through NAT Router via UPnP (Universal Plug and Play) - http://pietschsoft.com/post.aspx?id=31200e6d-4b61-48b8-a9cb-91e3dd8e97f3
Chris Pietschmann
+1  A: 

I use this, which seems to work fine:

http://code.google.com/p/dotnetportmapper/

Walt D
+1  A: 

Intels UPNP Tools used to be able to export UPnP clients in C#. The suite is deprecated but ought still work.

A: 

This Intel UPnP tools have been re-released as open source tools at: http://opentools.homeip.net. The new tools are called the "Developer Tools for UPnP technologies". They are built in C# but there is a free code generator that will output C and C# stacks. The C stack will work on Windows and Linux.

Ylian