SocketClient
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 class@Gio.SocketConnection subclass on success.
The type of the class@Gio.SocketConnection 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 class@Gio.TcpConnection.
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.
Skipped during bindings generation
method
proxy-resolver
: Property TypeInfo of getter and setter do not matchmethod
type
: Property has no getter nor setter
Since
2.22
Constructors
Properties
Enable proxy support.
The address family to use for socket construction.
The local address constructed sockets will be bound to.
The protocol to use for socket construction, or 0
for default.
The TLS validation flags used when creating TLS connections. The default value is %G_TLS_CERTIFICATE_VALIDATE_ALL.
Functions
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.
Tries to resolve the @connectable and make a network connection to it.
This is the asynchronous version of g_socket_client_connect().
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:
Finishes an async connect operation. See g_socket_client_connect_async()
This is a helper function for g_socket_client_connect().
This is the asynchronous version of g_socket_client_connect_to_host().
Finishes an async connect operation. See g_socket_client_connect_to_host_async()
Attempts to create a TCP connection to a service.
This is the asynchronous version of g_socket_client_connect_to_service().
Finishes an async connect operation. See g_socket_client_connect_to_service_async()
This is a helper function for g_socket_client_connect().
This is the asynchronous version of g_socket_client_connect_to_uri().
Finishes an async connect operation. See g_socket_client_connect_to_uri_async()
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().
Gets the socket type of the socket client.
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.
Sets the socket type of the socket client. The sockets created by this object will be of the specified type.