[gnutls-help] Truly non-blocking example of gnutls usage

Alex Bligh alex at alex.org.uk
Fri Apr 8 10:36:07 CEST 2016

Is there a simple, easy to reuse, example of gnu-tls acting like a
proxy which is truly non-blocking? By truly non-blocking I mean using
non-blocking writes as well as non-blocking reads. The danger I
am concerned about is receiving a large amount of plain-text,
gnutls converting that to cypher-text, attempting to write it
but blocking because the remote side is not ready to receive it.
The remote side is not ready to receive it because it has its
own output blocked as gnutls is not polling for reads as
it's blocked above, meaning deadlock.

I've done this for OpenSSL, and it was a pain (frankly).
I'd now like to do it for gnutls as I'd like to incorporate
the result into a GPL project, and OpenSSL's licensing
may be considered problematic. Therefore an example which
is GPL / GPL-compatible would be great. Otherwise an
example of how I could do it would be good. Something like
stunnel written with gnutls would be ideal.

Unless I'm missing something gnutls-cli only does non-blocking
reads (not non-blocking writes).

Alex Bligh

More information about the Gnutls-help mailing list