lue of <a href="../man3/SSL_get_stream_read_state.html">SSL_get_stream_read_state(3)</a> to determine whether the error is local to the stream, or whether the underlying connection has also failed. A return value of <b>SSL_STREAM_STATE_RESET_REMOTE</b> tells you that the stream has been reset by the peer and <b>SSL_STREAM_STATE_CONN_CLOSED</b> tells you that the underlying connection has closed.</p>

<p>In our demo application we will write a function to handle these errors from OpenSSL I/O functions:</p>

