setting an SSL_accept(...) timeout

2010-04-04 Thread Adam Grossman
hello,

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.

thank you,
-=- adam grossman

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


Re: setting an SSL_accept(...) timeout

2010-04-04 Thread Dr. Stephen Henson
On Sun, Apr 04, 2010, Adam Grossman wrote:

 hello,
 
 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.
 

The only way to reliably do this is with non-blocking I/O at the application
level. 

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: setting an SSL_accept(...) timeout

2010-04-04 Thread Adam Grossman
Peter-Michael,

thanks for the info, but this is on linux.

-=- adam grossman

On Sun, 2010-04-04 at 19:40 +0200, PMHager wrote:
 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 Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org


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


RE: setting an SSL_accept(...) timeout

2010-04-04 Thread PMHager
Adam Grossman wrote:
 thanks for the info, but this is on linux.

The socket interface is almost the same on linux:

#include sys/socket.h 

int  hSocket;
int  dwTimeout=1000; // milliseconds

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

[http://linux.die.net/man/3/setsockopt]

Peter-Michael

--

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


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


RE: setting an SSL_accept(...) timeout

2010-04-04 Thread Adam Grossman
i have done networking programming for a while, and i have never run
across that before.  thank you so much, you have just saved me a lot of
development time!

-=- adam grossman

On Sun, 2010-04-04 at 22:34 +0200, PMHager wrote:
 Adam Grossman wrote:
  thanks for the info, but this is on linux.
 
 The socket interface is almost the same on linux:
 
 #include sys/socket.h 
 
 int  hSocket;
 int  dwTimeout=1000; // milliseconds
 
 setsockopt(hSocket,SOL_SOCKET,SO_RCVTIMEO,(void*)dwTimeout,sizeof dwTimeout);
 setsockopt(hSocket,SOL_SOCKET,SO_SNDTIMEO,(void*)dwTimeout,sizeof 
 dwTimeout); 
 
 [http://linux.die.net/man/3/setsockopt]
 
 Peter-Michael
 
 --
 
 Peter-Michael Hager - acm senior - HAGER-ELECTRONICS GmbH - Germany
 
 
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org


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