[Help-gnutls] GNU TLS inside a loop: what to do at each iteration?

Nikos Mavroyanopoulos nmav at gnutls.org
Thu Nov 6 10:12:20 CET 2003


On Wed, Nov 05, 2003 at 01:12:28PM +0100, Stephane Bortzmeyer wrote:

> Hello,

> I tried, at every iteration:
> gnutls_transport_set_ptr (session, gnutls_transport_ptr) sockfd);
> gnutls_handshake (session);
> ... Work
> gnutls_bye (session, GNUTLS_SHUT_RDWR);
> But it fails at the second iteration (-10: The specified session has
> been invalidated for some reason. (Bad file descriptor)).
Yes, this is not a correct use of a gnutls session.

> I then tried:
> gnutls_init(&session, GNU_TLS_CLIENT);
> gnutls_transport_set_ptr (session, gnutls_transport_ptr) sockfd);
> gnutls_handshake (session);
> ... Work
> gnutls_bye (channel.tls, GNUTLS_SHUT_RDWR);
> gnutls_deinit (session); 
> And it fails at the second iteration (ASN1 parser: Element was not
> found. (Bad file descriptor).

You probably haven't called gnutls_global_init(). In any case try reading
the examples on how to properly initialize a TLS session.

-- 
Nikos Mavroyanopoulos





More information about the Gnutls-help mailing list