From a72e053d32b4f3a191ee36ec394b003e83012b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Brodbeck?= Date: Mon, 4 Jan 2021 20:21:22 +0100 Subject: [PATCH] sock/dtls: add example of a blocking handshake to the doc --- sys/include/net/sock/dtls.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/include/net/sock/dtls.h b/sys/include/net/sock/dtls.h index 5788ae06ca..a1a129d488 100644 --- a/sys/include/net/sock/dtls.h +++ b/sys/include/net/sock/dtls.h @@ -907,6 +907,14 @@ ssize_t sock_dtls_send_aux(sock_dtls_t *sock, sock_dtls_session_t *remote, * @note When blocking, we will need an extra thread to call * @ref sock_dtls_recv() function to handle the incoming handshake * messages. + * An example for a blocking handshake is: + * 1. Create an empty @ref sock_dtls_session_t object. + * 2. Set the UDP endpoint of the peer you want to connect to in the + * session object with @ref sock_dtls_session_set_udp_ep(). + * 3. Call @ref sock_dtls_send() with a timeout greater than 0. + * The send function blocks until the handshake completes or the + * timeout expires. If the handshake was successful the data has + * been sent. * * @return The number of bytes sent on success * @return -ENOTCONN, if `timeout == 0` and no existing session exists with