title: Non-Blocking I/O With OpenSSL BIO
body: <p>I am using OpenSSL 1.0.0-fips on Linux. The issue I am having is that <code>SSL_connect()</code> is returning -1 and <code>SSL_get_error()</code> is returning <code>SSL_ERROR_WANT_READ</code>. I then put the file descriptor into a <code>select()</code> with a <code>timeval</code> structure set to 10 seconds and the <code>select()</code> just times out. </p>
  
  <p>I fired up Wireshark and I see the "Client Hello" go out and I see the <code>ServerHello</code> come back to the client but it never "wakes up" in the <code>select()</code>. It just times out.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Do I have to create a BIO object using <code>BIO_new_socket()</code> and then assign the BIO object to my SSL object using <code>SSL_set_bio()</code>? The man page for <code>SSL_set_fd()</code> says it will automatically create a BIO object so that seems to imply that <code>SSL_set_bio()</code> is sort of a useless function that you never really have to call.</p></li>
  <li><p>Let us say we use <code>SSL_set_fd()</code> and assign a connected TCP file descriptor that is blocking. Let us say that we then later change that file descriptor to non-blocking using <code>fcntl()</code>. Does this break the SSL object (or the underlying BIO object) in anyway?</p></li>
  </ol>