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).
solved How detect received message in DTLS?