lundi 24 juillet 2017

pthread_create : passing an argument as the last argument

I have the following functions :

void Servlet(SSL* ssl)  /* Serve the connection -- threadable */
{   char buf[1024];
char reply[1024];
int sd, bytes;
const char* HTMLecho="<html><body><pre>%s</pre></body></html>\n\n";

if ( SSL_accept(ssl) == FAIL )          /* do SSL-protocol accept */
    ERR_print_errors_fp(stderr);
else
{

    ShowCerts(ssl);                             /* get any certificates */
    bytes = SSL_read(ssl, buf, sizeof(buf));    /* get request */
    if ( bytes > 0 )
    {
        buf[bytes] = 0;
        printf("Client msg: \"%s\"\n", buf);
        sprintf(reply, HTMLecho, buf);          /* construct reply */
        SSL_write(ssl, reply, strlen(reply));   /* send reply */
    }
    else
        ERR_print_errors_fp(stderr);
    }
    sd = SSL_get_fd(ssl);           /* get socket    connection */
    SSL_free(ssl);                                  /* release SSL state */
    close(sd);                                      /* close connection */
    }

and in main part program:

 pthread_create(&threadA[noThread], NULL, Servlet,(SSL*)(ssl));

But after compile, I see error for argument 3 pthread_create! how to fix it?

Aucun commentaire:

Enregistrer un commentaire