I'm trying to add new static port mapping in my c# application. Because my application runs as a server and i want its to listen on the port 8000.
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(8000, "TCP", 8000, "192.168.1.100", true, "Local Web Server");
but it doesn't work!, The exception was the following :
Object reference not set to an instance of an object.
Does anyone can help me please?
This is what i'm doing : http://pietschsoft.com/post/2009/02/05/NET-Framework-Communicate-through-NAT-Router-via-UPnP.aspx
mappings
? Did you initialize it? Put your full code here.. – Boisleduc