SocketClient.setTls

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 gio.SocketClient must return a gio.SocketConnection, but GTlsClientConnection is not a gio.SocketConnection, this actually wraps the resulting GTlsClientConnection in a gio.TcpWrapperConnection when returning it. You can use TcpWrapperConnection.getBaseIoStream 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 accept-certificate signal), you can connect to client's 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.

class SocketClient
void
setTls
(
bool tls
)

Parameters

tls bool

whether to use TLS

Meta

Since

2.28