OpenSSL interrupt blocking SSL_read
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: OpenSSL interrupt blocking SSL_read

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    OpenSSL interrupt blocking SSL_read

    Hi,
    I'm trying to implement tls client with openssl.
    I need to use blocking SSL_read that timeouts after specified period.
    On unix a frequently used pattern is something like this:
    alarm(timeout_seconds)
    SSL_read (...
    alarm(0)

    The problem is that I can't find "alarm" equivalent function under windows that would interrupt SSL_read call. Have tried with SetWaitableTimer but the timer doesn't seem to do the trick.
    Any help will be appreciated!

  2. #2
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,111

    Re: OpenSSL interrupt blocking SSL_read

    maybe you could set the RECEIVE_TIMEOUT on the underlying socket via setsockopt?

  3. #3
    Join Date
    Jun 2011
    Posts
    2

    Re: OpenSSL interrupt blocking SSL_read

    Thanks a lot Richard,

    Setting the sock option like so:

    DWORD dwTimeout = 5000; // 5 seconds
    setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&dwTimeout, sizeof(DWORD)) ;

    works just fine!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center