On Thu, Mar 03, 2005, Peter wrote:

> Thanks,
> So BIO_new_socket would create a BIO around the socket of my choosing 
> which would be more portable than doing BIO_set_fd afterwards?  But 
> then the current code uses BIO_new_ssl_connect to create the bio in the 
> first place.  I assume I would replace this with BIO_new_socket and 
> BIO_new_ssl  except I'm not sure how this chains the BIOs together.  I 
> would use BIO_push I assume but I'm not exactly sure of the order.  And 
> then the other thing, which probably has something to do with all of 
> this, is that I can't seem to close the connection.  It closes on exit 
> of the program but BIO_ssl_shutdown, I guess, only shuts down the SSL 
> bio and just doing BIO_get_fd and then "close" on the resulting socket 
> doesn't seem to work.  "lsof -i" still lists it as open until the 
> program exits.
> 

You need to append the relevant socket BIO to the SSL bio so:

bio = BIO_push(sslbio, socketbio);

is what you want. As for closing the socket if you have the BIO_CLOSE flag set
it will be closed when the BIO is freed with BIO_free_all(bio);

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to