Set Time out for SSL read

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Set Time out for SSL read

Raj-66
Hi All
    Is there any method to set time our for SSL _read function.
    As from the Open SSL document SSL_read will not return if there is no data to read from the socket

Thanks,
Raj
Rajmohan SK
Reply | Threaded
Open this post in threaded view
|

Re: Set Time out for SSL read

JoelKatz
On 9/29/2010 11:41 PM, Raj wrote:

> Hi All
> Is there any method to set time our for SSL _read function.
> As from the Open SSL document SSL_read will not return if there is no
> data to read from the socket

You really shouldn't need this. If you know for sure that it's the other
side's turn to transmit, you should be timing out the connection (or
even application) as a whole, not just the read. If you don't know for
sure that it's the other side's turn to transmit, you should not be
making a blocking call to SSL_read.

In any event, I recommend that you basically never use blocking functions.

DS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Set Time out for SSL read

Raj-66
Hi
  Thank you so much for your reply
  Can you please let me know how can I set time out as a whole. I think you
are mentioning about SSL_CTX_Set_timeout function. If it is so then I have
set the time out using this function, and sadly I didn't get the expected
result.

Thanks,
Raj
Rajmohan SK

----- Original Message -----
From: "David Schwartz" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, September 30, 2010 6:09 PM
Subject: Re: Set Time out for SSL read


> On 9/29/2010 11:41 PM, Raj wrote:
>
>> Hi All
>> Is there any method to set time our for SSL _read function.
>> As from the Open SSL document SSL_read will not return if there is no
>> data to read from the socket
>
> You really shouldn't need this. If you know for sure that it's the other
> side's turn to transmit, you should be timing out the connection (or even
> application) as a whole, not just the read. If you don't know for sure
> that it's the other side's turn to transmit, you should not be making a
> blocking call to SSL_read.
>
> In any event, I recommend that you basically never use blocking functions.
>
> DS
>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [hidden email]
> Automated List Manager                           [hidden email]
>


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Set Time out for SSL read

JoelKatz
On 9/30/2010 11:39 PM, Raj wrote:

> Can you please let me know how can I set time out as a whole. I think
> you are mentioning about SSL_CTX_Set_timeout function. If it is so then
> I have set the time out using this function, and sadly I didn't get the
> expected result.

There are a lot of ways. The most common is 'alarm'. Your platform may
also have a particular way of timing out TCP connections such as through
a 'setsockopt'. This is an ugly method and, IMO, is only appropriate in
a program that needs to terminate if the connection is lost.

DS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]