Gio.SocketClient (original) (raw)

Class

GioSocketClient

since: 2.22

Description [src]

class Gio.SocketClient : GObject.Object
{
  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 aGSocketConnection 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/IPconnection 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

Constructors

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 callingg_socket_connection_get_remote_address() on the returnedGSocketConnection, 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_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().

since: 2.36

g_socket_client_get_tls

Gets whether client creates TLS connections. Seeg_socket_client_set_tls() for details.

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 aGProxyResolver to determine if a proxy protocol such as SOCKS is needed, and automatically do the necessary proxy negotiation.

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_INVALIDthen the sockets created by this object will be of the specified family.

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.

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.

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.

since: 2.36

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).

since: 2.26

g_socket_client_set_tls

Sets whether client creates TLS (aka SSL) connections. If tls isTRUE, client will wrap its connections in a GTlsClientConnectionand perform a TLS handshake when connecting.

since: 2.28

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Signals

Gio.SocketClient::event

Emitted when client‘s 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:.

since: 2.32

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

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
  );
  
}

No description available.

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