I am opening a .doc or .xls or .zip file with fopen in "rb" mode,

Reading file into char buffer, and passing that buffer to SSL_write,
Return value of SSL_write is 8. though buffersize is more than 8 bytes.

Here is the sample code.

        FILE *fp;
        char *wbuf;

        fp = fopen("C:\\pp.xls", "rb");

        if (fp == NULL)
        {
                printf("Error opening file\n");
                return;
        }

        // obtain the file size 

        fseek(fp, 0, SEEK_END);
        long fsize = ftell(fp);
        rewind(fp);
        
        wbuf = (char *)malloc (sizeof(char)*fsize);
        if (wbuf == NULL)
        {
                printf("Memory error\n");
                return;
        }

     int result = fread(wbuf, fsize, 1, fp); 

     void *buffer;
     buffer = (char *)malloc (length);

     long err = SSL_write(ssl,buffer, strlen((char *)buffer));
    
     err = SSL_get_error(ssl,err);



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Schwartz
Sent: Monday, September 10, 2007 8:57 PM
To: openssl-users@openssl.org
Subject: RE: sending binary data using openSSL


> I am using OpenSSL in my project. I wanted to send binary data,

The term "binary data" could mean anything.

>  but SSL_write is not working.

That's not a very good description of the problem.

> Is there any other way to do it.

You really have to give us something more to go on.

DS


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

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

Reply via email to