Method

GioSocketClientset_tls

since: 2.28

Declaration

void
g_socket_client_set_tls (
  GSocketClient* client,
  gboolean tls
)

Description

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.

Note that since GSocketClient must return a GSocketConnection, but GTlsClientConnection is not a GSocketConnection, this actually wraps the resulting GTlsClientConnection in a GTcpWrapperConnection when returning it. You can use g_tcp_wrapper_connection_get_base_io_stream() on the return value to extract the GTlsClientConnection.

If you need to modify the behavior of the TLS handshake (eg, by setting a client-side certificate to use, or connecting to the GTlsConnection::accept-certificate signal), you can connect to clients GSocketClient::event signal and wait for it to be emitted with G_SOCKET_CLIENT_TLS_HANDSHAKING, which will give you a chance to see the GTlsClientConnection before the handshake starts.

Available since: 2.28

Sets propertyGio.SocketClient:tls

Parameters

tls

Type: gboolean

Whether to use TLS.