Hi
 
I have tried to use BIO pair and for some reason it doesn't
seem to work right. So, here is the code if someone could
tell me what's going wrong.
 
I have tried to make it work without SSL_set_fd and SSL_accept, but it won't work.
 
 
  ssl = SSL_new (ctx);     
 
  SSL_set_fd (ssl, sd);                        // Do I need this line at all?   sd = socket

  BIO *internalbio = new BIO;
  BIO *networkbio = new BIO;
 
  BIO_new_bio_pair(&internalbio, 1000, &networkbio, 1000);
 
  SSL_set_bio(ssl, internalbio, internalbio);
 
  err = SSL_accept (ssl);                      // Must I make SSL connection startup manually? 
  
  int ret;
 
  ret = recv(sd, buf, 4000, 0);
 
  ret = BIO_write(networkbio, buf, ret);
 
  char buf2[4096];
  ret = BIO_read(networkbio, buf2, 4000);
 
  SSL_free(ssl);
  BIO_free(networkbio);

Reply via email to