More robust error checking.
Loop on recv and send operations for non-blocking sockets with OpenSSL.