Hi

I use to write data to openssl the follow function

int hb_inetSSLWrite(int com,SSL* pSSL, int timeout, char * msg, int
length, int* iRet)
{

   int ret;
   int sslerr;
   int r;
   fd_set fd_r, fd_w;
   struct timeval tv;

   do
   {
      ret = SSL_write(pSSL, msg, length);
      sslerr = SSL_get_error(pSSL, ret);

      if ( ret > 0)
      {
        r = 1;
        *iRet = 0;
        break;
      }
      *iRet = sslerr;
      FD_ZERO( &fd_r );
      FD_ZERO( &fd_w );
      if( timeout > 0 )
      {
         tv.tv_sec = timeout  / 1000;
         tv.tv_usec = ( timeout % 1000 ) * 1000;
      }

      switch (sslerr)
      {
         case SSL_ERROR_WANT_READ:
            FD_SET(com,&fd_r);
            break;
         case SSL_ERROR_WANT_WRITE:
            FD_SET(com,&fd_w);
            break;
         default:
            return -1;
      }
      if( timeout > 0 )
         r = select(com+1,&fd_r,&fd_w,NULL,&tv);
      else
         r = select(com+1,&fd_r,&fd_w,NULL,NULL);

   } while ( ret == -1 && r != 0 );

   if ( r == 0)
      return -1;

   return ret;
}

Regards
Luiz
> Forwarding to openssl-users for public discussion.
>
> Best regards,
>       Lutz
>
> ----- Forwarded message from sandeep.kuma...@wipro.com -----
>
> Subject: SSL_write returned SSL_ERROR_SSL
> Date: Tue, 3 Nov 2009 19:25:03 +0530
> Thread-Topic: SSL_write returned SSL_ERROR_SSL
> Thread-Index: AcpcjT4Rk9sPCTZ0QEaWqLVTn71DBQ==
> From: sandeep.kuma...@wipro.com
> To: r...@openssl.org
>
> I am facing some weird problem in SSL_write(). Most of the times it
> returned with "SSL_ERROR_SSL".
> Can anyone explain what is this error and how can we fix this.
> I am using 0.9.8g openssl version.
>
> Any assistance (including temporary workarounds) appreciated.
>
> Thanks....
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you
> are not the intended recipient, you should not disseminate, distribute or
> copy this e-mail. Please notify the sender immediately and destroy all
> copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses.
> The company accepts no liability for any damage caused by any virus
> transmitted by this email.
>
> www.wipro.com
>
> ----- End forwarded message -----
> --
> Lutz Jaenicke           jaeni...@openssl.org
> OpenSSL Project         http://www.openssl.org/~jaenicke/
> ______________________________________________________________________
> 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