The following works on Windows. Haven't tried any other OS. After the TCP connect completes and you have a connected non-blocking socket,
 
bio = BIO_new_socket( connected_socket, BIO_NOCLOSE ); /* your application closes the socket */
BIO_set_nbio( bio, 1 ); /* tell OpenSSL that the socket is non-blocking */
ssl = SSL_new( ctx );
SSL_set_bio( ssl, bio, bio );
 
Then repeat the following while connected_socket is active in the writing set and either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE:
 
SSL_connect( ssl );
 

______________________________

John Hoel
Product Author

Skywire Software
2401 Internet Blvd., Suite 201
Frisco, Texas 75034
(972)377-1110 main
(425)396-4687 direct
[EMAIL PROTECTED]

www.skywiresoftware.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Aftab Alam
Sent: Tuesday, May 03, 2005 6:02 AM
To: openssl-users@openssl.org
Subject: non blocking SSL connect

Hi All,

 

I am trying to create a non blocking ssl connection.

 

I created a BIO and converted it to non blocking with ioctlsocket on windows and fcntl on linux

 

if i try http connection on this BIO it works fine and times out at specified time on addresses where it is unable to connect

 as non blocking socket should using 'select' but if i convert it into ssl socket, SSL_connect never returns on addresses where it is unable to connect although

it works fine with the valid addresses.

although the underlying bio is non blocking but SSL_connect still seems to use blocking socket.

After converting to nonblocking socket i call SSL_connect this way. pls help me where i am worng

 

this->m_pSSLSocket = SSL_new(this->m_pSSLContext);

SSL_set_bio(this->m_pSSLSocket,Socket,Socket);

           

int ErrCode = SSL_connect(this->m_pSSLSocket);BIO *socket = BIO_new_connect(host:port);

 

 

Regards,

 

NO RELIANCE:  This e-mail will be of no force of effect and will not be binding unless a hard copy of this e-mail, signed by an authorized official of the company, has been sent to the recipient of this message.

CONFIDENTIAL AND/OR PROPRIETARY:  Information contained in this transmission is intended for the use of the individual or entity named above and may contain legally proprietary or confidential information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copy of this communication is strictly prohibited. If you have received this communication in error, please permanently delete this message and immediately notify us by telephone at 972-377-1110.

Reply via email to