[Help-gnutls] gnutls_bye(), return values, and looping

Nikos Mavroyanopoulos nmav at gnutls.org
Mon Feb 2 16:47:23 CET 2004

Quoting Joe Shaw <joe at ximian.com>:

> On Sun, 2004-02-01 at 15:09, Nikos Mavroyanopoulos wrote:
> > GNUTLS_E_AGAIN is returned because the underlying layer (recv or send)
> > returned EAGAIN. gnutls does not use this error value.
> Ok, recv(2) says that EAGAIN would be returned if the socket was
> nonblocking (which it is) and there are no messages to be read.  Is it
> safe then to ignore the GNUTLS_E_AGAIN value (and therefore check only
> GNUTLS_E_INTERRUPTED) and then close the file descriptor?  Are the
> examples in the docs correct in ignoring the return values?
The examples in the documentation are with blocking servers
(and the error checking is almost inexistant). To avoid this
case you could use gnutls_bye() with _WR only and either
wait for an EOF from gnutls_recv() or just close the socket.

> Thanks,
> Joe

nmav at gnutls.org

More information about the Gnutls-help mailing list