On Wed, Oct 11, 2000 at 06:39:08PM -0400, Louis LeBlanc wrote:
> My question now is this:  Is there a specific state, or (small) set of
> states, that I can check for on any SSL connection (for all versions)
> and verify that the connection is established, and ready for some kind
> of I/O?

Wait for SSL_connect() to terminate (un)successfully...

finished_connect = 0;
while (!finished_connect) {
   ret=SSL_connect(ssl_con):
   errcode=SSL_get_error(ssl_con, ret);
   switch (errcode) {
   case SSL_ERROR_NONE:
     finished_connect = 1;      /* Hurray, connection established */
     break;
   case SSL_ERROR_WANT_READ:
   case SSL_ERROR_WANT_WRITE:
     perform select() like functions and wait for bytes to be sent or received;
     break;
   case SSL_ERROR_ZERO_RETURN:
     finished_connect = 1;      /* The peer closed cleanly, no connection */
     break;
   default:
     finished_connect = 1;      /* Fatal error */
     break;
   }
}
if (errocode == SSL_ERROR_NONE)
  connection_established();
else
  handle_connection_failure();

Best,
        Lutz
-- 
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to