NAME
SSL_read — read bytes from a TLS/SSL connectionDESCRIPTION
SSL_read() tries to read num bytes from the specified ssl into the buffer buf.NOTES
If necessary, SSL_read() will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the SSL_read() operation. The behaviour of SSL_read() depends on the underlying BIO.WARNING
When an SSL_read() operation has to be repeated because of SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, it must be repeated with the same arguments.RETURN VALUES
The following return values can occur:- >0
- The read operation was successful; the return value is the number of bytes actually read from the TLS/SSL connection.
- 0
-
The read operation was not successful. The reason may either be a clean shutdown due to a “close notify” alert sent by the peer (in which case the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set (see SSL_shutdown(3) and SSL_set_shutdown(3)). It is also possible that the peer simply shut down the underlying transport and the shutdown is incomplete. Call SSL_get_error() with the return value to find out whether an error occurred or the connection was shut down cleanly (SSL_ERROR_ZERO_RETURN).SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only be detected whether the underlying connection was closed. It cannot be checked whether the closure was initiated by the peer or by something else.
- <0
- The read operation was not successful, because either an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value to find out the reason.