Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:51:10+00:00 2026-05-25T06:51:10+00:00

while(1) { read_blocked_on_write=0; const int buff_len = 1024; char buff[buff_len]; iResult = SSL_read(ssl, buff,

  • 0
while(1)
{
    read_blocked_on_write=0;

    const int buff_len = 1024;
    char buff[buff_len];

    iResult = SSL_read(ssl, buff, buff_len);

    int ssl_err = SSL_get_error(ssl, iResult);
    if(ssl_err == SSL_ERROR_NONE)
    {
        if(offset + iResult > recvbuflen - 1)
        {
            FD_ZERO(&fdread);
            FD_ZERO(&fdwrite);
            MessageBox(hwnd, TEXT("ERROR"), TEXT("Not enough memory!"), MB_OK | MB_ICONERROR);
            return 1;
        }
        memcpy(recvbuf + offset, buff, iResult);
        offset += iResult;
        if(SSL_pending(ssl))
        {
            continue;
        }
        else
        {
            bFinish = true;
            break;
        }
    }
    else if(ssl_err == SSL_ERROR_ZERO_RETURN)
    {
        bFinish = true;
        break;
    }
    else if(ssl_err == SSL_ERROR_WANT_READ)
    {
        break;
    }
    else if(ssl_err == SSL_ERROR_WANT_WRITE)
    {
        /* We get a WANT_WRITE if we're
        trying to rehandshake and we block on
        a write during that rehandshake.

        We need to wait on the socket to be 
        writeable but reinitiate the read
        when it is */
        read_blocked_on_write=1;
        break;
    }
    else
    {
        FD_ZERO(&fdread);
        FD_ZERO(&fdwrite);
        MessageBox(hwnd, TEXT("ERROR"), TEXT("SSL problem!"), MB_OK | MB_ICONERROR);
        return 1;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:51:11+00:00Added an answer on May 25, 2026 at 6:51 am

    I’m no ssl expert but it’s likely because there is nothing to read. You are reading and moving a buffer (which takes milliseconds at most) and then terminating if there is nothing more to read at that instant. Meanwhile you are dealing with the much slower network speeds and decryption at the lower layer. It’s not at all improbable that there is nothing to be returned at that moment.

    Why have that check there at all? Wouldn’t alternatively opening the socket as non-blocking be the way to go if you are trying to multiplex or whatever?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <stdio.h> int main() { char read = ' '; while ((read = getchar())
according to some tutorials i read a while back, the const declaration makes a
I'm trying to do something like var=0 grep foo bar | while read line;
while (true) { //read in the file StreamReader convert = new StreamReader(../../convert.txt); //define variables
I used the XMLReader format: XmlReader xmlReader = XmlReader.Create(batch.xml); while (xmlReader.Read()) { //Keep reading
In the below code, using (SqlDataReader dr = com.ExecuteReader(CommandBehavior.CloseConnection)) { while (dr.Read()) { _emailTemplate.EmailContent
A while ago I read the Mocks Aren't Stubs article by Martin Fowler and
I have read that while plug-ins are not supported for SQL Server Management Studio,
A while back i read somewhere about how to improve upon the MVC pattern
I want to ask how can someone read keystrokes while in a html page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.