utdown(3)</a> function which has the effect of sending a TLS protocol level message (a &quot;close_notify&quot; alert) to the server saying that we have finished writing data:</p>

<pre><code>/*
 * The peer already shutdown gracefully (we know this because of the
 * SSL_ERROR_ZERO_RETURN above). We should do the same back.
 */
ret = SSL_shutdown(ssl);
if (ret &lt; 1) {
    /*
     * ret &lt; 0 indicates an error. ret == 0 would be unexpected here
     * because that means &quot;we&#39;ve sent a close_notify