[gnutls-help] Problems with async read on a tls session

Nicolas Mora nicolas at babelouest.org
Sun Oct 7 14:18:10 CEST 2018


Hello,

I'm implementing a websocket client library over https, so I need to run
asynchronous read on the gnutls session to be able to send messages
while I'm receiving them.

I'm having trouble detecting if the socket has incoming activity,
gnutls_record_check_pending, it always return 0.

I'm based on the "Client example with X.509 certificate support" to make
my http connection, so the tcp socket is basically initiated like that
(pseudo-code):

tcp_sock = socket(AF_INET, SOCK_STREAM, 0);
connect(tcp_sock, (struct sockaddr *)&server , sizeof(server));
gnutls_transport_set_int(gnutls_session, tcp_sock);
gnutls_handshake_set_timeout(gnutls_session,
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);

What do I miss to have a working async connection?

Thanks in advance

/Nicolas



More information about the Gnutls-help mailing list