Table of Contents

Class UpnpDevice

Namespace
Godot
Assembly
GodotSharp.dll

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.

[GodotClassName("UPNPDevice")]
public class UpnpDevice : RefCounted, IDisposable
Inheritance
UpnpDevice
Implements
Inherited Members

Constructors

UpnpDevice()

public UpnpDevice()

Properties

DescriptionUrl

URL to the device description.

public string DescriptionUrl { get; set; }

Property Value

string

IgdControlUrl

IDG control URL.

public string IgdControlUrl { get; set; }

Property Value

string

IgdOurAddr

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

public string IgdOurAddr { get; set; }

Property Value

string

IgdServiceType

IGD service type.

public string IgdServiceType { get; set; }

Property Value

string

IgdStatus

IGD status. See UpnpDevice.IgdStatusEnum.

public UpnpDevice.IgdStatusEnum IgdStatus { get; set; }

Property Value

UpnpDevice.IgdStatusEnum

ServiceType

Service type.

public string ServiceType { get; set; }

Property Value

string

Methods

AddPortMapping(int, int, string, string, int)

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

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

Parameters

port int
portInternal int
desc string
proto string
duration int

Returns

int

DeletePortMapping(int, string)

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

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

Parameters

port int
proto string

Returns

int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsValidGateway()

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

public bool IsValidGateway()

Returns

bool

QueryExternalAddress()

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

public string QueryExternalAddress()

Returns

string