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

Simon Josefsson jas at extundo.com
Mon Mar 21 23:45:06 CET 2005

Daniel Stenberg <daniel at haxx.se> writes:

> 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? Or could 
> it return with one of those return codes while still having data to be 
> processed without having to wait for anything on the socket?
> Or did I just miss this (too) in the manual?

This is written in haste, and probably doesn't answer your
question...  Anyway, is the thread in


of any help?

If I understand correctly, though, GnuTLS perform some internal
buffering, so calling select might not be reliable.  But I don't have
much experience with non-blocking I/O and GnuTLS.  Perhaps Nikos can
chime in.  I'm not sure how portable it is for GnuTLS to push data
back into the OS buffers, which would be one way to make select() work
as expected.


More information about the Gnutls-help mailing list