Hi everybody,
I'm writing an application that creates multiple non-blocking SSL connections to an https server, in each one I send a request and read the server's response. my problem is, whatever I do, I can't determine when the response data is finished. here's part of my code responsible for sending and receiving data: ....fd_set connectionfds;structtimeval timeout2;FD_ZERO(&connectionfds);FD_SET(socket_server,&connectionfds);timeout2.tv_usec =0;timeout2.tv_sec =1;while(1){r=BIO_read(io,buf,BUFSIZZ-1);if(r>0){//gather datacontinue;}elseif(SSL_get_error(ssl,r)==SSL_ERROR_WANT_READ){intret =select(socket_server +1,&connectionfds,NULL,NULL,&timeout2);if(ret <=0){break;}continue;}else{break;}}// use whole gathered data.... my problem with above code is, if I set select timeout to a small time, I can't guarantee that all data is received (because some servers are really slow), and if I set timeout to a long time (5-10 seconds), my socket is getting stucked in wait-state for a long time and I can't use the response before that. I tried to make this work by using "BIO_should_read()" or "BIO_pending()" functions, but none of them is giving me what I want. so, Is there a way to determine when exactly there is nothing else to read on the SSL socket? Thank you.