W Wrapl, The Programming Language

Libraries:Gtk:Gio:GNetworkAddress

Types

T

Inherits from:

T provides an easy way to resolve a hostname and then attempt to connect to that host, handling the possibility of multiple IP addresses and multiple address families.

See Gtk.Gio.GSocketConnectable.T for and example of using the connectable interface.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New(hostname @ Std.String.T, port @ Std.Integer.SmallT) : Gtk.Gio.GNetworkAddress.T

Creates a new Gtk.Gio.GSocketConnectable.T for connecting to the given hostname and port.

hostname the hostname
port the port
Returns the new T. [transfer full]


Parse(host_and_port @ Std.String.T, default_port @ Std.Integer.SmallT, error @ Std.Object.T) : Gtk.Gio.GSocketConnectable.T

Creates a new Gtk.Gio.GSocketConnectable.T for connecting to the given hostname and port. May fail and return NULL in case parsing host_and_port fails.

host_and_port may be in any of a number of recognised formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon.

If no port is specified in host_and_port then default_port will be used as the port number to connect to.

In general, host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port overide if necessary) and default_port is expected to be provided by the application.

(The port component of host_and_port can also be specified as a service name rather than as a numeric port, but this functionality is deprecated, because it depends on the contents of /etc/services, which is generally quite sparse on platforms other than Linux.)

host_and_port the hostname and optionally a port
default_port the default port if not in host_and_port
error a pointer to a Gtk.Glib.GError.T, or NULL
Returns the new T, or NULL on error. [transfer full]


ParseUri(uri @ Std.String.T, default_port @ Std.Integer.SmallT, error @ Std.Object.T) : Gtk.Gio.GSocketConnectable.T

Creates a new Gtk.Gio.GSocketConnectable.T for connecting to the given uri. May fail and return NULL in case parsing uri fails.

Using this rather than g_network_address_new() or g_network_address_parse_host() allows Gtk.Gio.GSocketClient.T to determine when to use application-specific proxy protocols.

uri the hostname and optionally a port
default_port The default port if none is found in the URI
error a pointer to a Gtk.Glib.GError.T, or NULL
Returns the new T, or NULL on error. [transfer full]


Methods

:GetHostname(self @ T) : Std.String.T

Gets addr's hostname. This might be either UTF-8 or ASCII-encoded, depending on what addr was created with.

addr a T
Returns addr's hostname


:GetPort(self @ T) : Std.Integer.SmallT

Gets addr's port number

addr a T
Returns addr's port (which may be 0)


:GetScheme(self @ T) : Std.String.T

Gets addr's scheme

addr a T
Returns addr's scheme (NULL if not built from URI)


:Priv(self @ T) : Std.Object.T

:setPriv(self @ T, value @ Std.Object.T) : Std.Object.T