I'm attempting to create a client/server program, but I'm finding some difficulty continuing with the unfortunately sparse amount of OpenSSL documentation.

My issue:
`SSL_accept` throws an "Invalid Argument" upon executing the following code (simplified):

```
SSL* ssl = SSL_new(ctx); // ctx is created earlier
SSL_set_fd(ssl, socket); // socket is created earlier as well
BIO * bio = BIO_new(BIO_s_accept());
BIO_set_fd(bio, socket, BIO_NOCLOSE);
SSL_set_bio(ssl, bio, bio);
SSL_accept(ssl); 

```

I check errors after each method call, and the neither the socket nor the bio goes bad. There's no indication that anything odd is happening until I attempt calling SSL\_accept. I assume that the ssl object was corrupted somewhere along the way, but I don't have a clue as to how~

**Edit** The SSL object and the BIO object are *not* null at the point of calling SSL\_accept().

Any pointers in the right direction would be greatly appreciated :D