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

Stephane Bortzmeyer bortzmeyer at nic.fr
Wed Nov 5 13:12:28 CET 2003


Hello,

I'm porting echoping <URL:http://echoping.sourceforge.net/> from
OpenSSL to GNU TLS and I have a question about looping. echoping can
perform a given test repeatedly. What do I have to do at each
iteration?

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)).

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).

[For the record, OpenSSL has exactly the same problems and the
documentation is quite misleading.]






More information about the Gnutls-help mailing list