[ Version ( since = "2.28" ) ]
public void set_tls (bool tls)

Sets whether this creates TLS (aka SSL) connections.

If tls is true, this will wrap its connections in a TlsClientConnection and perform a TLS handshake when connecting.

Note that since SocketClient must return a SocketConnection, but TlsClientConnection is not a SocketConnection, this actually wraps the resulting TlsClientConnection in a TcpWrapperConnection when returning it. You can use get_base_io_stream on the return value to extract the TlsClientConnection.

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 this'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 TlsClientConnection before the handshake starts.



a SocketClient.


whether to use TLS