On Tue October 25 2011, Akanksha Shukla wrote:
> Hi Stephen,
> 
>  
> 
> I added debug code as:
> 
>  
> 
> int retryCounter = 0;
> 
> while(retryCounter < CONNECT_MAX_TRY)
> 
> {
> 
>     int retVal = BIO_do_connect(conn);
> 
>     if(retVal <= 0)
> 
>     {
> 
>          if(BIO_should_retry(conn))
> 
>          {
> 
>               retryCounter++;
> 
>               sleep(CONNECT_SLEEP_INTERVAL);
> 
>               FILE * pFile;
> 
>               pFile = fopen ("result_retry.txt","a");
> 
>               if (pFile!=NULL)
> 
>               {
> 
>                    ERR_print_errors_fp(pFile);
> 
>               }
> 
>               continue;
> 
>         }
> 
>         else
> 
>         {
> 
>             
> 
>       FILE * pFile1;
> 
>                 pFile1 = fopen ("result.txt","a");
> 
>                 if (pFile1!=NULL)
> 
>                 {
> 
>                     ERR_print_errors_fp(pFile1);
> 
>                  }
> 
>                 cout << " The Bio_do_connect failed" << endl;
> 
>  
> 
>         }
> 
>    }
> 
> }
> 
>  
> 
> After execution of program, I saw that only "result.txt" file is getting
> created and not the "result_retry.txt" file which clarifies that the retry
> logic is working fine. Problem comes when retry counter reaches its max
> value and Bio_do_connect() gets failed. Though my understanding might be
> wrong here. 
> 
>  
> 
> But the main problem which I encountered today is that nothing is being
> written in the file "result.txt" and I am also hoping that I am using the
> ERR_print_errors_fp() function in correct way. The file is blank. Then just
> to make sure that pFile1 handle returned as Not NULL and we are entering
> inside the if check, I added statement
> 
> If(pfile1! = NULL)
> 
> {
> 
>      fputs ("fopen example",pFile);
> 
>      //ERR_print_errors_fp(pFile1);
> 
> }
> 
>  
> 
> And this time, I could see that "fopen example" is being written to
> result.txt file successfully.
> 
>  
> 
> So, could you please suggest what mistake I am doing here that SSL errors
> are not being getting written in file and also any other suggestions to try
> out.  
>

Q? How many times do you intend to open that file inside of the
while loop without ever flushing or closing it?

Mike 
>  
> 
> Thanks
> 
> Akanksha Shukla.
> 
>  
> 
> -----Original Message-----
> From: owner-openssl-us...@openssl.org
> [mailto:owner-openssl-us...@openssl.org] On Behalf Of Dr. Stephen Henson
> Sent: Tuesday, October 25, 2011 4:34 AM
> To: openssl-users@openssl.org
> Subject: Re: Open SSL API's Support For IPv6.
> 
>  
> 
> On Sun, Oct 23, 2011, Akanksha Shukla wrote:
> 
>  
> 
> > Hi Stephen,
> 
> > 
> 
> >  
> 
> > 
> 
> > I tried with retry logic as well (though earlier it was also same), but
> same
> 
> > result.
> 
> > 
> 
> >  
> 
> > 
> 
> > int retryCounter = 0;
> 
> > 
> 
> > while(retryCounter < CONNECT_MAX_TRY)
> 
> > 
> 
> > {
> 
> > 
> 
> >     int retVal = BIO_do_connect(conn);
> 
> > 
> 
> >     if(retVal <= 0)
> 
> > 
> 
> >     {
> 
> > 
> 
> >          if(BIO_should_retry(conn))
> 
> > 
> 
> >          {
> 
> > 
> 
> >               retryCounter++;
> 
> > 
> 
> >               sleep(CONNECT_SLEEP_INTERVAL);
> 
> > 
> 
> >               continue;
> 
> > 
> 
> >         }
> 
> > 
> 
> >         else
> 
> > 
> 
> >         {
> 
> > 
> 
> >             cout << " The Bio_do_connect failed" << endl;
> 
> > 
> 
> >  
> 
> > 
> 
> >         }
> 
> > 
> 
> >    }
> 
> > 
> 
> > }
> 
> > 
> 
> >  
> 
> > 
> 
> > Just wanted to let you know that this piece of code is same at time when I
> 
> > used BIO_new_connect() followed by BIO_set_nbio() and Bio_do_connect()
> with
> 
> > similar code mentioned above, then things were working fine. This time
> 
> > rather than using Bio_new_connect(), I used socket(), connect() and
> 
> > Bio_new_socket() API call followed by bio_set_nbio() and Bio_do_connect()
> 
> > (as suggested by you), then things started failing.
> 
> > 
> 
> >  
> 
> > 
> 
> > Please let me know if you have any suggestions or help me in pointing out
> 
> > the issue.
> 
> > 
> 
> >  
> 
>  
> 
> Try adding some more debugging code to see if it actually does retry and
> also
> 
> if it fails call the OpenSSL ERR library to print out any useful message.
> For
> 
> example ERR_print_errors_fp(stderr);
> 
>  
> 
> Steve.
> 
> --
> 
> Dr Stephen N. Henson. OpenSSL project core developer.
> 
> Commercial tech support now available see: http://www.openssl.org
> 
> ______________________________________________________________________
> 
> OpenSSL Project                                 http://www.openssl.org
> 
> User Support Mailing List                    openssl-users@openssl.org
> 
> Automated List Manager                           majord...@openssl.org
> 
> 


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to