[Libevent-users] SSL enabling libevent programs, is there an example available?

Thomas Harning harningt at gmail.com
Mon Jan 21 19:34:25 EST 2008


Ron Arts wrote:
> Hi,
>
> subject says it all. If there's no example with
> libevent, can someone recommend another place to look?
> I tried Googling but couldn't find a concise example. 
For example, w/ OpenSSL you can turn the socket to be non-blocking and 
watch for what openssl 'needs' after a failed attempt to read/write...
Ex:
int ret = SSL_read(ssl, buffer, len);
if(ret < 0) {
    int err = SSL_get_error(ret);
    switch(err) {
     case SSL_ERROR_WANT_WRITE:
        /* Hook up libevent to wait on write then retry w/ exact same 
argument */
        break;
    case SSL_ERROR_WANT_READ:
       /* Hook up libevent to wait on read then ... */
       break;
    default: /* Something else..... */
  }
}


More information about the Libevent-users mailing list