Class IPInstance
- Namespace
- Godot
- Assembly
- GodotSharp.dll
IP contains support functions for the Internet Protocol (IP). TCP/IP support is in different classes (see StreamPeerTcp and TcpServer). IP provides DNS hostname resolution support, both blocking and threaded.
[GodotClassName("IP")]
public class IPInstance : GodotObject, IDisposable
- Inheritance
-
IPInstance
- Implements
- Inherited Members
Methods
ClearCache(string)
Removes all of a hostname
's cached references. If no hostname
is given, all cached IP addresses are removed.
public void ClearCache(string hostname = "")
Parameters
hostname
string
EraseResolveItem(int)
Removes a given item id
from the queue. This should be used to free a queue after it has completed to enable more queries to happen.
public void EraseResolveItem(int id)
Parameters
id
int
GetLocalAddresses()
Returns all the user's current IPv4 and IPv6 addresses as an array.
public string[] GetLocalAddresses()
Returns
- string[]
GetLocalInterfaces()
Returns all network adapters as an array.
Each adapter is a dictionary of the form:
{
"index": "1", # Interface index.
"name": "eth0", # Interface name.
"friendly": "Ethernet One", # A friendly name (might be empty).
"addresses": ["192.168.1.101"], # An array of IP addresses associated to this interface.
}
public Array<Dictionary> GetLocalInterfaces()
Returns
GetResolveItemAddress(int)
Returns a queued hostname's IP address, given its queue id
. Returns an empty string on error or if resolution hasn't happened yet (see GetResolveItemStatus(int)).
public string GetResolveItemAddress(int id)
Parameters
id
int
Returns
GetResolveItemAddresses(int)
Returns resolved addresses, or an empty array if an error happened or resolution didn't happen yet (see GetResolveItemStatus(int)).
public Array GetResolveItemAddresses(int id)
Parameters
id
int
Returns
GetResolveItemStatus(int)
Returns a queued hostname's status as a IP.ResolverStatus constant, given its queue id
.
public IP.ResolverStatus GetResolveItemStatus(int id)
Parameters
id
int
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
ResolveHostname(string, Type)
Returns a given hostname's IPv4 or IPv6 address when resolved (blocking-type method). The address type returned depends on the IP.Type constant given as iPType
.
public string ResolveHostname(string host, IP.Type iPType = Type.Any)
Parameters
Returns
ResolveHostnameAddresses(string, Type)
Resolves a given hostname in a blocking way. Addresses are returned as an Array of IPv4 or IPv6 addresses depending on iPType
.
public string[] ResolveHostnameAddresses(string host, IP.Type iPType = Type.Any)
Parameters
Returns
- string[]
ResolveHostnameQueueItem(string, Type)
Creates a queue item to resolve a hostname to an IPv4 or IPv6 address depending on the IP.Type constant given as iPType
. Returns the queue ID if successful, or ResolverInvalidId on error.
public int ResolveHostnameQueueItem(string host, IP.Type iPType = Type.Any)