Adam Grossman wrote:
> is there a way i can set a timeout for an SSL_accept, either if the
> handshake does not complete within X seconds (prefered), or even if it
> is waiting on a blocking socket and no data comes in for X seconds.  I
> know i can use alarms, but i was wondering (hoping), there was a
> mechanism already built into the OpenSSL APIs.

This is part of the Winsock functions. If you need a different timeouts
in the different states, just call setsockopt() appropriate.

#include <winsock2.h>

SOCKET  hSocket;
DWORD   dwTimeout=1000; // milliseconds

setsockopt(hSocket,SOL_SOCKET,SO_RCVTIMEO,(char*)&dwTimeout,sizeof dwTimeout);
setsockopt(hSocket,SOL_SOCKET,SO_SNDTIMEO,(char*)&dwTimeout,sizeof dwTimeout);

 Peter-Michael

--

Peter-Michael Hager - acm senior - HAGER-ELECTRONICS GmbH - Germany


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to