On the client side, it is never necessary to call this method;
although the connection needs to perform a handshake after
connecting (or after sending a "STARTTLS"-type command) and may
need to rehandshake later if the server requests it,
#GDtlsConnection will handle this for you automatically when you try
to send or receive data on the connection. However, you can call
g_dtls_connection_handshake() manually if you want to know for sure
whether the initial handshake succeeded or failed (as opposed to
just immediately trying to write to @conn, in which
case if it fails, it may not be possible to tell if it failed
before or after completing the handshake).
Likewise, on the server side, although a handshake is necessary at
the beginning of the communication, you do not need to call this
function explicitly unless you want clearer error reporting.
If TLS 1.2 or older is in use, you may call
g_dtls_connection_handshake() after the initial handshake to
rehandshake; however, this usage is deprecated because rehandshaking
is no longer part of the TLS protocol in TLS 1.3. Accordingly, the
behavior of calling this function after the initial handshake is now
undefined, except it is guaranteed to be reasonable and
nondestructive so as to preserve compatibility with code written for
older versions of GLib.
#GDtlsConnection::accept_certificate may be emitted during the
handshake.
Attempts a TLS handshake on @conn.
On the client side, it is never necessary to call this method; although the connection needs to perform a handshake after connecting (or after sending a "STARTTLS"-type command) and may need to rehandshake later if the server requests it, #GDtlsConnection will handle this for you automatically when you try to send or receive data on the connection. However, you can call g_dtls_connection_handshake() manually if you want to know for sure whether the initial handshake succeeded or failed (as opposed to just immediately trying to write to @conn, in which case if it fails, it may not be possible to tell if it failed before or after completing the handshake).
Likewise, on the server side, although a handshake is necessary at the beginning of the communication, you do not need to call this function explicitly unless you want clearer error reporting.
If TLS 1.2 or older is in use, you may call g_dtls_connection_handshake() after the initial handshake to rehandshake; however, this usage is deprecated because rehandshaking is no longer part of the TLS protocol in TLS 1.3. Accordingly, the behavior of calling this function after the initial handshake is now undefined, except it is guaranteed to be reasonable and nondestructive so as to preserve compatibility with code written for older versions of GLib.
#GDtlsConnection::accept_certificate may be emitted during the handshake.