This method creates a new port mapping or overwrites an existing mapping.

C# | Visual Basic | Visual C++ | F# |
public void AddPortMapping( bool enabled, string description, string protocol, string remoteHost, int publicPort, IPEndPoint localEP, int leaseDuration )
Public Sub AddPortMapping ( enabled As Boolean, description As String, protocol As String, remoteHost As String, publicPort As Integer, localEP As IPEndPoint, leaseDuration As Integer )
public: void AddPortMapping( bool enabled, String^ description, String^ protocol, String^ remoteHost, int publicPort, IPEndPoint^ localEP, int leaseDuration )
member AddPortMapping : enabled : bool * description : string * protocol : string * remoteHost : string * publicPort : int * localEP : IPEndPoint * leaseDuration : int -> unit

- enabled (Boolean)
- Specifies if port mapping is enabled.
- description (String)
- Port mapping description.
- protocol (String)
- Port mapping protocol. Nomrally this value TCP or UDP.
- remoteHost (String)
- Remote host IP address.
- publicPort (Int32)
- Desired public port.
- localEP (IPEndPoint)
- Local IP end point.
- leaseDuration (Int32)
- Lease duration in seconds. Value null means never expires.

Exception | Condition |
---|---|
ArgumentNullException | Is raised when description,protocol or localEP is null reference. |
UPnP_Exception | Is raised when UPnP device returns error. |
Assembly: LumiSoft.Net (Module: LumiSoft.Net.dll) Version: 4.5.5510.19119