(&quot;Failed reading remaining data\n&quot;);
    goto end;
}</code></pre>

<p>If <a href="../man3/SSL_get_error.html">SSL_get_error(3)</a> returns <b>SSL_ERROR_ZERO_RETURN</b> then we know that the server has finished sending its data. Otherwise an error has occurred.</p>

<h2 id="Shutting-down-the-connection">Shutting down the connection</h2>

<p>Once we have finished reading data from the server then we are ready to close the connection down. We do this via the <a href="../man3/SSL_shutdown.html">SSL_sh