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

Nikos Mavrogiannopoulos nmav at gnutls.org
Fri Apr 8 15:35:29 CEST 2016

On Fri, Apr 8, 2016 at 10:36 AM, Alex Bligh <alex at alex.org.uk> wrote:
> 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.

Blocking is a matter of the underlying socket functions. If you set
the sockets to non blocking mode gnutls operates in a non-blocking way
almost identically to berkeley sockets. Have you checked the manual?

The simplest example is mini-eagain.c from the test suite which
verifies the asynchronous operation of gnutls_record_send and recv.


More information about the Gnutls-help mailing list