title: Using OpenSSL TLS with or without BIO?
body: <p>I've been reading a lot about OpenSSL, specifically the TLS and DTLS APIs. Most of it makes sense, it's a pretty intuitive API once you understand it. One thing has really got me scratching my head though...</p>
  
  <p>When/why would I use BIOs?</p>
  
  <p>For example, <a href="https://wiki.openssl.org/index.php/Simple_TLS_Server" rel="nofollow noreferrer">this wiki page</a> demonstrates setting up a barebones TLS server. There isn't even a <em>mention</em> of BIOs anywhere in the example.</p>
  
  <p>Now <a href="https://web.archive.org/web/20130327081616/http://www.ibm.com/developerworks/linux/library/l-openssl/index.html" rel="nofollow noreferrer">this page</a> Uses BIOs exclusively, not ever using the read and write functions of the SSL struct. Granted it's from 2013, but it's not the only one that uses BIOs.</p>
  
  <p>To make it even more confusing <a href="https://www.openssl.org/docs/manmaster/man3/SSL_read.html" rel="nofollow noreferrer">this man page</a> suggests that the SSL struct has an "underlying BIO" <em>without ever needing to set it explicitly</em>.</p>
  
  <p>So why would I use BIOs if I can get away with using <code>SSL_read()</code> and <code>SSL_write()</code>? What are the advantages? Why do some examples use BIOs and others don't? What Is the Airspeed Velocity of an Unladen Swallow?</p>