W Wrapl, The Programming Language

Libraries:Gtk:Gio:GSocketClient

Types

T

Inherits from:

T is a high-level utility class for connecting to a network host using a connection oriented socket type.

You create a T object, set any options you want, and then call a sync or async connect operation, which returns a Gtk.Gio.GSocketConnection.T subclass on success.

The type of the Gtk.Gio.GSocketConnection.T object returned depends on the type of the underlying socket that is in use. For instance, for a TCP/IP connection it will be a Gtk.Gio.GTcpConnection.T.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gio.GSocketClient.T

Creates a new T with the default options.

Returns a T. Free the returned object with g_object_unref().


Methods

:AddApplicationProxy(self @ T, protocol @ Std.String.T) : Std.Object.T

Enable proxy protocols to be handled by the application. When the indicated proxy protocol is returned by the Gtk.Gio.GProxyResolver.T, T will consider this protocol as supported but will not try to find a Gtk.Gio.GProxy.T instance to handle handshaking. The application must check for this case by calling Gtk.Gio.GSocketConnection.GetRemoteAddress on the returned Gtk.Gio.GSocketConnection.T, and seeing if it's a Gtk.Gio.GProxyAddress.T of the appropriate type, to determine whether or not it needs to handle the proxy handshaking itself.

This should be used for proxy protocols that are dialects of another protocol such as HTTP proxy. It also allows cohabitation of proxy protocols that are reused between protocols. A good example is HTTP. It can be used to proxy HTTP, FTP and Gopher and can also be use as generic socket proxy through the HTTP CONNECT method.

client a T
protocol The proxy protocol


:Connect(self @ T, connectable @ Gtk.Gio.GSocketConnectable.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Tries to resolve the connectable and make a network connection to it.

Upon a successful connection, a new Gtk.Gio.GSocketConnection.T is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

The type of the Gtk.Gio.GSocketConnection.T object returned depends on the type of the underlying socket that is used. For instance, for a TCP/IP connection it will be a Gtk.Gio.GTcpConnection.T.

The socket created will be the same family as the address that the connectable resolves to, unless family is set with SetFamily or indirectly via SetLocalAddress. The socket type defaults to Gtk.Gio.GSocketType.Stream but can be set with SetSocketType.

If a local address is specified with SetLocalAddress the socket will be bound to this address before connecting.

client a T.
connectable a Gtk.Gio.GSocketConnectable.T specifying the remote address.
cancellable optional Gtk.Gio.GCancellable.T object, NULL to ignore. [allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectAsync(self @ T, connectable @ Gtk.Gio.GSocketConnectable.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T

This is the asynchronous version of Connect.

When the operation is finished callback will be called. You can then call ConnectFinish to get the result of the operation.

client a T
connectable a Gtk.Gio.GSocketConnectable.T specifying the remote address.
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:ConnectFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Finishes an async connect operation. See ConnectAsync

client a T.
result a Gtk.Gio.GAsyncResult.T.
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectToHost(self @ T, host_and_port @ Std.String.T, default_port @ Std.Integer.SmallT, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

This is a helper function for Connect.

Attempts to create a TCP connection to the named host.

host_and_port may be in any of a number of recognized 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. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).

If no port override is given 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 override if necessary) and default_port is expected to be provided by the application.

In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.

Upon a successful connection, a new Gtk.Gio.GSocketConnection.T is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) NULL is returned and error (if non-NULL) is set accordingly.

client a T
host_and_port the name and optionally port of the host to connect to
default_port the default port to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
error a pointer to a Gtk.Glib.GError.T, or NULL
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectToHostAsync(self @ T, host_and_port @ Std.String.T, default_port @ Std.Integer.SmallT, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T

This is the asynchronous version of ConnectToHost.

When the operation is finished callback will be called. You can then call ConnectToHostFinish to get the result of the operation.

client a T
host_and_port the name and optionally the port of the host to connect to
default_port the default port to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:ConnectToHostFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Finishes an async connect operation. See ConnectToHostAsync

client a T.
result a Gtk.Gio.GAsyncResult.T.
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectToService(self @ T, domain @ Std.String.T, service @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Attempts to create a TCP connection to a service.

This call looks up the SRV record for service at domain for the "tcp" protocol. It then attempts to connect, in turn, to each of the hosts providing the service until either a connection succeeds or there are no hosts remaining.

Upon a successful connection, a new Gtk.Gio.GSocketConnection.T is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) NULL is returned and error (if non-NULL) is set accordingly.

client a Gtk.Gio.GSocketConnection.T
domain a domain name
service the name of the service to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
error a pointer to a Gtk.Glib.GError.T, or NULL
Returns a Gtk.Gio.GSocketConnection.T if successful, or NULL on error. [transfer full]


:ConnectToServiceAsync(self @ T, domain @ Std.String.T, service @ Std.String.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T

This is the asynchronous version of ConnectToService.

client a T
domain a domain name
service the name of the service to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:ConnectToServiceFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Finishes an async connect operation. See ConnectToServiceAsync

client a T.
result a Gtk.Gio.GAsyncResult.T.
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectToUri(self @ T, uri @ Std.String.T, default_port @ Std.Integer.SmallT, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

This is a helper function for Connect.

Attempts to create a TCP connection with a network URI.

uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI, default_port will be used. TLS will be negotiated if "tls" is TRUE. (T does not know to automatically assume TLS for certain URI schemes.)

Using this rather than Connect or ConnectToHost allows T to determine when to use application-specific proxy protocols.

Upon a successful connection, a new Gtk.Gio.GSocketConnection.T is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) NULL is returned and error (if non-NULL) is set accordingly.

client a T
uri A network URI
default_port the default port to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
error a pointer to a Gtk.Glib.GError.T, or NULL
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:ConnectToUriAsync(self @ T, uri @ Std.String.T, default_port @ Std.Integer.SmallT, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data @ Std.Address.T) : Std.Object.T

This is the asynchronous version of ConnectToUri.

When the operation is finished callback will be called. You can then call ConnectToUriFinish to get the result of the operation.

client a T
uri a network uri
default_port the default port to connect to
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:ConnectToUriFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Finishes an async connect operation. See ConnectToUriAsync

client a T.
result a Gtk.Gio.GAsyncResult.T.
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:GetEnableProxy(self @ T) : Std.Symbol.T

Gets the proxy enable state; see SetEnableProxy

client a T.
Returns whether proxying is enabled


:GetFamily(self @ T) : Gtk.Gio.GSocketFamily.T

Gets the socket family of the socket client.

See SetFamily for details.

client a T.
Returns a Gtk.Gio.GSocketFamily.T


:GetLocalAddress(self @ T) : Gtk.Gio.GSocketAddress.T

Gets the local address of the socket client.

See SetLocalAddress for details.

client a T.
Returns a Gtk.Gio.GSocketAddress.T or NULL. Do not free. [transfer none]


:GetProtocol(self @ T) : Gtk.Gio.GSocketProtocol.T

Gets the protocol name type of the socket client.

See SetProtocol for details.

client a T
Returns a Gtk.Gio.GSocketProtocol.T


:GetSocketType(self @ T) : Gtk.Gio.GSocketType.T

Gets the socket type of the socket client.

See SetSocketType for details.

client a T.
Returns a Gtk.Gio.GSocketFamily.T


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

Gets the I/O timeout time for sockets created by client.

See SetTimeout for details.

client a T
Returns the timeout in seconds


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

:SetEnableProxy(self @ T, enable @ Std.Symbol.T) : Std.Object.T

Sets whether or not client attempts to make connections via a proxy server. When enabled (the default), T will use a Gtk.Gio.GProxyResolver.T to determine if a proxy protocol such as SOCKS is needed, and automatically do the necessary proxy negotiation.

client a T.
enable whether to enable proxies


:SetFamily(self @ T, family @ Gtk.Gio.GSocketFamily.T) : Std.Object.T

Sets the socket family of the socket client. If this is set to something other than Gtk.Gio.GSocketFamily.Invalid then the sockets created by this object will be of the specified family.

This might be useful for instance if you want to force the local connection to be an ipv4 socket, even though the address might be an ipv6 mapped to ipv4 address.

client a T.
family a Gtk.Gio.GSocketFamily.T


:SetLocalAddress(self @ T, address @ Gtk.Gio.GSocketAddress.T) : Std.Object.T

Sets the local address of the socket client. The sockets created by this object will bound to the specified address (if not NULL) before connecting.

This is useful if you want to ensure that the local side of the connection is on a specific port, or on a specific interface.

client a T.
address a Gtk.Gio.GSocketAddress.T, or NULL


:SetProtocol(self @ T, protocol @ Gtk.Gio.GSocketProtocol.T) : Std.Object.T

Sets the protocol of the socket client. The sockets created by this object will use of the specified protocol.

If protocol is 0 that means to use the default protocol for the socket family and type.

client a T.
protocol a Gtk.Gio.GSocketProtocol.T


:SetSocketType(self @ T, type @ Gtk.Gio.GSocketType.T) : Std.Object.T

Sets the socket type of the socket client. The sockets created by this object will be of the specified type.

It doesn't make sense to specify a type of Gtk.Gio.GSocketType.Datagram, as GSocketClient is used for connection oriented services.

client a T.
type a Gtk.Gio.GSocketType.T


:SetTimeout(self @ T, timeout @ Std.Integer.SmallT) : Std.Object.T

Sets the I/O timeout for sockets created by client. timeout is a time in seconds, or 0 for no timeout (the default).

The timeout value affects the initial connection attempt as well, so setting this may cause calls to Connect, etc, to fail with Gtk.Gio.GIOErrorEnum.TimedOut.

client a T.
timeout the timeout


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