Does anybody have a sample piece of C code that connects to a Telnet server via 
OPENSSL ?  I have attempted to write it myself, however, my call to SSL_connect() 
fails.  After the failure, I call ERR_get_error() and it returns a 0 (no error).  My 
code looks as follows:

int NSI_SSL_OPEN(SOCKET cli_sock)
{
        SSL_METHOD *meth=NULL;
        SSL_CTX* ctx=NULL;
        int err;
        int ERR_no;

        
        SSL_load_error_strings();
        meth=SSLv23_client_method();
        SSLeay_add_ssl_algorithms();
        ctx = SSL_CTX_new(meth);
        con=(SSL *)SSL_new(ctx);
        err = SSL_set_fd (con, cli_sock);               
        err = SSL_connect(con);
        if(err == -1)
        {
                ERR_no = ERR_get_error();
                if(ERR_no)
                {
                        err=ERR_no;
                        
MessageBox(GetFocus(),"NSISSL.DLL",ERR_error_string(ERR_no,NULL),MB_ICONSTOP);
                        while(ERR_no = ERR_get_error())
                                
MessageBox(GetFocus(),"NSISSL.DLL",ERR_error_string(ERR_no,NULL),MB_ICONSTOP);
                }
        }
        else
                err = 0;
        return(err);
}


Thank You,

Jeff Roberts


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to