I found this snippet for implementing a timeout for sockets, although
the example had nothing to do with SSL... I put it in some code and it
seems to work fine, but was wondering if anybody else has tried it or
can comment on the idea.  Thanks!

/////// snippet:
int err;
fd_set fds;
struct timeval tv;

FD_ZERO(&fds);
FD_SET(socket, &fds);
tv.tv_sec  = 10000; // ten seconds
tv.tv_usec = 0;

// wait for timeout
// err = select(socket+1, NULL, &fds, NULL, &tv); // write
err = select(socket+1, &fds, NULL, NULL, &tv); // read
if (err == 0)  return -2; // timeout
if (err == -1) return -1; // error

// if we're here, we're OK to do a send
// SSL_write( ... )
SSL_read( ... )


This e-mail is confidential.  If you are not the intended recipient, you must 
not disclose or use the information contained in it.  If you have received this 
e-mail in error, please tell us immediately by return e-mail to [EMAIL 
PROTECTED] and delete the document.

E-mails containing unprofessional, discourteous or offensive remarks violate 
Sentry policy. You may report employee violations by forwarding the message to 
[EMAIL PROTECTED]

No recipient may use the information in this e-mail in violation of any civil 
or criminal statute. Sentry disclaims all liability for any unauthorized uses 
of this e-mail or its contents.

This e-mail constitutes neither an offer nor an acceptance of any offer. No 
contract may be entered into by a Sentry employee without express approval from 
an authorized Sentry manager.

Warning: Computer viruses can be transmitted via e-mail. Sentry accepts no 
liability or responsibility for any damage caused by any virus transmitted with 
this e-mail.

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

Reply via email to