c++copenssldtlswolfssl

How detect received message in DTLS?


I implement DTLS protocol for CoAP on C, C++. As I see I can use OpenSSL or WolfSSL. For example WolfSSL:

https://github.com/wolfSSL/wolfssl-examples/blob/master/dtls/client-dtls-nonblocking.c

But how I can detect that some message has been sent to me?


Solution

  • In nonblocking operation, you typically have a point in the program where it waits for any of the nonblocking file descriptors to report availability of data.

    In the example you linked, that's the select(...) line. In practice, you either have such a central select yourself, or have the main loop run by another library to which you pass the descriptors of whose readiness you want to be notified (eg. in GTK that might be g_source_add_unix_fd).