SSL_peek - Copy the data in the SSL buffer into the buffer
passed to this API
#include <openssl/ssl.h>
int SSL_peek(
SSL *s,
void *buf,
int num );
The SSL_peek() function copies num bytes from the specified
ssl into the buffer buf. In constrast to the
SSL_read() function, the data in the SSL buffer is unmodified
after the SSL_peek() operation.
The following return values can occur: The peek operation
was successful; the return value is the number of bytes
actually copied from the TLS/SSL connection. The peek
operation was not successful; the SSL connection was
closed by the peer by sending a ``close notify'' alert.
The SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state
is set. (See SSL_shutdown(), SSL_set_shutdown(). Call
SSL_get_error() with the return value ret to determine
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. The peek 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 ret to find
out the reason.
Functions: SSL_read(3)
SSL_peek(3)
[ Back ] |