>         I am trying to use ssl_read in the loop for receiving the data
> of
> unknown size ( say 988 bytes for now ). But it fails to read after a
> single pass. Everytime it exits with ret = 32 and error=SSL_ERROR_NONE.
> Am I missing something here .. Please find attached the code snippet. Is
> there any example code available ?

        Your code is broken in several ways. For one thing, when is the loop
supposed to return, assuming there is no error?

>         char buf[1024];
>         bool loop=TRUE;
>         if( !waitRead(error) )
>                 return -1;
>         else
>         {
>             do
>             {
>                 ret=SSL_read(ssl, buf, 32);
>
>                 printf("The data in ssl read is %s\n", buf);
>                                 if(ret > 0)/* Successful read */
>                                   break;
>
>                 int err = SSL_get_error(ssl, ret);
>
>                 switch(err)
>                 {SSL_ERROR_NONE
>                      case SSL_ERROR_NONE: /* this is not an error */

        Shouldn't there be a 'break' here?

>                      case SSL_ERROR_ZERO_RETURN: /* no more data */
>                                 loop=FALSE; /* get out of loop */
>                                 printf("No more data \n");
>                                 break;
>                      case SSL_ERROR_WANT_READ:
>                      case SSL_ERROR_WANT_WRITE:
>                                 printf("Pending data \n");
>                                 break;
>                 }
>                 }
>
>             }while(loop);
>         }

        The code you posted, even with the missing 'break' appears to continue
reading the data on an SSL connection, overwriting each 32 bytes with the
next 32 bytes, until the other side closes the connection or an error
occurs. It's hard to imagine how that's useful.

        DS


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

Reply via email to