[Help-gnutls] handshake with non-blocking sockets?

Nikos Mavrogiannopoulos nmav at gnutls.org
Tue Mar 22 16:02:36 CET 2005

On Monday 21 March 2005 23:10, Daniel Stenberg wrote:
> Hi

> Thanks Simon for the previous answers. I'm now progressing fine!
> Here's another question:
> When I use non-blocking sockets and call gnutls_handshake(). What happens
> and how should I behave? The manual doesn't mention non-blocking
> anywhere...
> When it returns GNUTLS_E_AGAIN, can I simply do a select() on the socket to
> wait for data to become readable or writable and then call it again?
Yes. In order to see whether you have to check for readability or writability
use the gnutls_record_get_direction() function.

> Or  could it return with one of those return codes while still having data 
> be processed without having to wait for anything on the socket? 
No. Non-blocking is on the sockets part, not in gnutls. Gnutls will always
process as much as possible permitted by the data available.

Nikos Mavrogiannopoulos

More information about the Gnutls-help mailing list