Class

GioSocketClient

Description [src]

class Gio.SocketClient : GObject.Object {
  parent_instance: GObject,
  priv: GSocketClientPrivate*
}

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

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

The type of the GSocketConnection 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 GTcpConnection.

As GSocketClient is a lightweight object, you don’t need to cache it. You can just create a new one any time you need one.

Available since:2.22

Hierarchy

hierarchy this GSocketClient ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

g_socket_client_new

Creates a new GSocketClient with the default options.

Available since: 2.22

Instance methods

g_socket_client_add_application_proxy

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

g_socket_client_connect

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

Available since: 2.22

g_socket_client_connect_async

This is the asynchronous version of g_socket_client_connect().

Available since: 2.22

g_socket_client_connect_finish

Finishes an async connect operation. See g_socket_client_connect_async()

Available since: 2.22

g_socket_client_connect_to_host

This is a helper function for g_socket_client_connect().

Available since: 2.22

g_socket_client_connect_to_host_async

This is the asynchronous version of g_socket_client_connect_to_host().

Available since: 2.22

g_socket_client_connect_to_host_finish

Finishes an async connect operation. See g_socket_client_connect_to_host_async()

Available since: 2.22

g_socket_client_connect_to_service

Attempts to create a TCP connection to a service.

g_socket_client_connect_to_service_async

This is the asynchronous version of g_socket_client_connect_to_service().

Available since: 2.22

g_socket_client_connect_to_service_finish

Finishes an async connect operation. See g_socket_client_connect_to_service_async()

Available since: 2.22

g_socket_client_connect_to_uri

This is a helper function for g_socket_client_connect().

Available since: 2.26

g_socket_client_connect_to_uri_async

This is the asynchronous version of g_socket_client_connect_to_uri().

Available since: 2.26

g_socket_client_connect_to_uri_finish

Finishes an async connect operation. See g_socket_client_connect_to_uri_async()

Available since: 2.26

g_socket_client_get_enable_proxy

Gets the proxy enable state; see g_socket_client_set_enable_proxy()

Available since: 2.26

g_socket_client_get_family

Gets the socket family of the socket client.

Available since: 2.22

g_socket_client_get_local_address

Gets the local address of the socket client.

Available since: 2.22

g_socket_client_get_protocol

Gets the protocol name type of the socket client.

Available since: 2.22

g_socket_client_get_proxy_resolver

Gets the GProxyResolver being used by client. Normally, this will be the resolver returned by g_proxy_resolver_get_default(), but you can override it with g_socket_client_set_proxy_resolver().

Available since: 2.36

g_socket_client_get_socket_type

Gets the socket type of the socket client.

Available since: 2.22

g_socket_client_get_timeout

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

Available since: 2.26

g_socket_client_get_tls

Gets whether client creates TLS connections. See g_socket_client_set_tls() for details.

Available since: 2.28

g_socket_client_get_tls_validation_flags

Gets the TLS validation flags used creating TLS connections via client.

Available since: 2.28

g_socket_client_set_enable_proxy

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

Available since: 2.26

g_socket_client_set_family

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

Available since: 2.22

g_socket_client_set_local_address

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.

Available since: 2.22

g_socket_client_set_protocol

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

Available since: 2.22

g_socket_client_set_proxy_resolver

Overrides the GProxyResolver used by client. You can call this if you want to use specific proxies, rather than using the system default proxy settings.

Available since: 2.36

g_socket_client_set_socket_type

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

Available since: 2.22

g_socket_client_set_timeout

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

Available since: 2.26

g_socket_client_set_tls

Sets whether client creates TLS (aka SSL) connections. If tls is TRUE, client will wrap its connections in a GTlsClientConnection and perform a TLS handshake when connecting.

Available since: 2.28

g_socket_client_set_tls_validation_flags

Sets the TLS validation flags used when creating TLS connections via client. The default value is G_TLS_CERTIFICATE_VALIDATE_ALL.

Available since: 2.28

Methods inherited from GObject (43)

Properties

Gio.SocketClient:enable-proxy
No description available.
Gio.SocketClient:family
No description available.
Gio.SocketClient:local-address
No description available.
Gio.SocketClient:protocol
No description available.
Gio.SocketClient:proxy-resolver

The proxy resolver to use.

Available since: 2.36

Gio.SocketClient:timeout
No description available.
Gio.SocketClient:tls
No description available.
Gio.SocketClient:tls-validation-flags
No description available.
Gio.SocketClient:type
No description available.

Signals

Gio.SocketClient::event

Emitted when clients activity on connectable changes state. Among other things, this can be used to provide progress information about a network connection in the UI. The meanings of the different event values are as follows:

Available since: 2.32

Signals inherited from GObject (1)

Class structure

struct GioSocketClientClass {
  GObjectClass parent_class;
  void (* event) (
    GSocketClient* client,
    GSocketClientEvent event,
    GSocketConnectable* connectable,
    GIOStream* connection
  );
  void (* _g_reserved1) (
void
  );
  void (* _g_reserved2) (
void
  );
  void (* _g_reserved3) (
void
  );
  void (* _g_reserved4) (
void
  );
  
}
Class members
parent_class
GObjectClass
  No description available.
event
void (* event) (
    GSocketClient* client,
    GSocketClientEvent event,
    GSocketConnectable* connectable,
    GIOStream* connection
  )
  No description available.
_g_reserved1
void (* _g_reserved1) (
void
  )
  No description available.
_g_reserved2
void (* _g_reserved2) (
void
  )
  No description available.
_g_reserved3
void (* _g_reserved3) (
void
  )
  No description available.
_g_reserved4
void (* _g_reserved4) (
void
  )
  No description available.

Virtual methods

Gio.SocketClientClass.event
No description available.