gnutls_record_check_pending() issue in GNUTLS 3.0.3 ??

Nikos Mavrogiannopoulos nmav at
Wed Nov 9 15:40:40 CET 2011

On 11/09/2011 03:30 PM, frank.krout at wrote:
> I'm integrating secure email support into an existing mailer app that 
> functions essentially as a mail client.
> So, in sending emails, the processing of SMTP command responses may be 
> delayed while waiting for a particular server.
> The legacy code handles this delay using the socket select() call to check 
> for input and timeout if nothing is coming back from a server.

You should continue using select() then. gnutls_check_pending() checks
for data in the gnutls_session_t buffers, not in the network buffers.
You should use it to complement select() (i.e., call select() if
gnutls_record_check_pending() returned zero).

This is what gnutls-cli does.

> hence, my reasoning for the need to sleep. 

You don't need it. Use select() instead.

> gnutls_record_recv() blocks if it has no data, yes??

If your socket is set to block it will block.


More information about the Gnutls-help mailing list