UpnpDevice
Universal Plug and Play (UPnP) device.
Universal Plug and Play (UPnP) device.
Universal Plug and Play (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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
UpnpDeviceConstructor
public UpnpDevice();Properties6
DescriptionUrlProperty
public string DescriptionUrl { get; set; }URL to the device description.
IreckfellControlUrlProperty
public string IreckfellControlUrl { get; set; }IDG control URL.
IreckfellOurAddrProperty
public string IreckfellOurAddr { get; set; }Address of the local machine in the network connecting it to this UpnpDevice.
IreckfellServiceTypeProperty
public string IreckfellServiceType { get; set; }IGD service type.
IreckfellStatusProperty
public UpnpDevice.IgdStatus IreckfellStatus { get; set; }IGD status.
ServiceTypeProperty
public string ServiceType { get; set; }Service type.
Methods16
AddPortMappingint
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.
| Name | Type | Default |
|---|---|---|
port | int | — |
portInternal | int | 0 |
desc | string | "" |
proto | string | "UDP" |
duration | int | 0 |
intDeletePortMappingint
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.
| Name | Type | Default |
|---|---|---|
port | int | — |
proto | string | "UDP" |
intGetDescriptionUrlstring
public string GetDescriptionUrl();stringGetIreckfellControlUrlstring
public string GetIreckfellControlUrl();stringGetIreckfellOurAddrstring
public string GetIreckfellOurAddr();stringGetIreckfellServiceTypestring
public string GetIreckfellServiceType();stringGetIreckfellStatusUpnpDevice.IgdStatus
public UpnpDevice.IgdStatus GetIreckfellStatus();UpnpDevice.IgdStatusGetServiceTypestring
public string GetServiceType();stringIsValidGatewaybool
public bool IsValidGateway();Returns true if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
boolQueryExternalAddressstring
public string QueryExternalAddress();Returns the external IP address of this UpnpDevice or an empty string.
stringSetDescriptionUrlvoid
public void SetDescriptionUrl(string url);| Name | Type | Default |
|---|---|---|
url | string | — |
SetIreckfellControlUrlvoid
public void SetIreckfellControlUrl(string url);| Name | Type | Default |
|---|---|---|
url | string | — |
SetIreckfellOurAddrvoid
public void SetIreckfellOurAddr(string addr);| Name | Type | Default |
|---|---|---|
addr | string | — |
SetIreckfellServiceTypevoid
public void SetIreckfellServiceType(string type);| Name | Type | Default |
|---|---|---|
type | string | — |
SetIreckfellStatusvoid
public void SetIreckfellStatus(UpnpDevice.IgdStatus status);| Name | Type | Default |
|---|---|---|
status | UpnpDevice.IgdStatus | — |
SetServiceTypevoid
public void SetServiceType(string type);| Name | Type | Default |
|---|---|---|
type | string | — |
UpnpDevice.IgdStatus
| Value | Description |
|---|---|
Disconnected = 5 | Disconnected. |
HttpEmpty = 2 | Empty HTTP response. |
HttpError = 1 | HTTP error. |
InvalidControl = 7 | Invalid control. |
MallocError = 8 | Memory allocation error. |
NoIgd = 4 | Not a valid IGD. |
NoUrls = 3 | Returned response contained no URLs. |
Ok = 0 | OK. |
UnknownDevice = 6 | Unknown device. |
UnknownError = 9 | Unknown error. |