I understand why nobody gave an answer to this question, because the crucial 
hint was missing: 
I am using the GLib GSocketService for handling incoming connections. The GLib 
uses non-blocking
sockets under the hood which I was not aware of. Especially the 
g_socket_set_blocking() function
does not affect the socket on the system layer but alters the behavior of the 
GSocket wrapper. 
The reason why my code did not work is that I should have used the 
BIO_should_retry() function
whenever the {BIO_do_handshake(), BIO_puts(), BIO_gets(),...} functions 
returned a return-code 
less than zero. 

I attached a minimal example of my working implementation.

Attachment: glib-tls-server.tbz
Description: Binary data


Reply via email to