UPNP device.
    public class UPNPDevice : Reference

UPNP device. See UPNP for UPNP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread.

Inheritance Chain


    public UPNPDevice()


    public string DescriptionUrl { get; set; }

URL to the device description.

    public string IgdControlUrl { get; set; }

IDG control URL.

    public string IgdOurAddr { get; set; }

Address of the local machine in the network connecting it to this UPNPDevice.

    public string IgdServiceType { get; set; }

IGD service type.

    public IGDStatus IgdStatus { get; set; }

IGD status. See IgdStatus.

    public string ServiceType { get; set; }

Service type.


    public int AddPortMapping(int port, int portInternal = 0, string desc = "", string proto = "UDP", int duration = 0)

Adds a port mapping to forward the given external port on this UPNPDevice for the given protocol to the local machine. See UPNP.AddPortMapping(int, int, string, string, int).

    public int DeletePortMapping(int port, string proto = "UDP")

Deletes the port mapping identified by the given port and protocol combination on this device. See UPNP.DeletePortMapping(int, string).

    public string GetDescriptionUrl()

Getter for DescriptionUrl

    public string GetIgdControlUrl()

Getter for IgdControlUrl

    public string GetIgdOurAddr()

Getter for IgdOurAddr

    public string GetIgdServiceType()

Getter for IgdServiceType

    public IGDStatus GetIgdStatus()

Getter for IgdStatus

    public string GetServiceType()

Getter for ServiceType

    public bool IsValidGateway()

Returns true if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.

    public string QueryExternalAddress()

Returns the external IP address of this UPNPDevice or an empty string.

    public void SetDescriptionUrl(string url)

Setter for DescriptionUrl

    public void SetIgdControlUrl(string url)

Setter for IgdControlUrl

    public void SetIgdOurAddr(string addr)

Setter for IgdOurAddr

    public void SetIgdServiceType(string type)

Setter for IgdServiceType

    public void SetIgdStatus(IGDStatus status)

Setter for IgdStatus

    public void SetServiceType(string type)

Setter for ServiceType

Inner Types


Name Value Description
Ok 0 OK.
HttpError 1 HTTP error.
HttpEmpty 2 Empty HTTP response.
NoUrls 3 Returned response contained no URLs.
NoIgd 4 Not a valid IGD.
Disconnected 5 Disconnected.
UnknownDevice 6 Unknown device.
InvalidControl 7 Invalid control.
MallocError 8 Memory allocation error.
UnknownError 9 Unknown error.