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
IgdControlUrl
IDG control URL.
public string IgdControlUrl { get; set; }
Property Value
IgdOurAddr
Address of the local machine in the network connecting it to this UpnpDevice.
public string IgdOurAddr { get; set; }
Property Value
IgdServiceType
IGD service type.
public string IgdServiceType { get; set; }
Property Value
IgdStatus
IGD status. See UpnpDevice.IgdStatusEnum.
public UpnpDevice.IgdStatusEnum IgdStatus { get; set; }
Property Value
ServiceType
Service type.
public string ServiceType { get; set; }
Property Value
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
Returns
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
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsValidGateway()
Returns true
if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
public bool IsValidGateway()
Returns
QueryExternalAddress()
Returns the external IP address of this UpnpDevice or an empty string.
public string QueryExternalAddress()