Sometimes my client can't receive data
llf at e-code.net
llf at e-code.net
Sat Sep 21 06:45:19 UTC 2019
Hello, everyone !
I'm using openssl as client in blocking mode , i have a problem .
Sometimes my program can't receive data , and acctually server has been sent the data to me.
I can only receive the data by sending another request . Then the data i expected arrived with a new data sent by server .
Below is my code
------------------------------------------------------------------------------
bool can_read()
{
struct timeval tv = {0 , 100};
FD_ZERO(&m_rfds);
FD_SET(m_socket.fd(), &m_rfds);
int ret = select( m_socket.fd()+1, &m_rfds , NULL, NULL, &tv);
return ret > 0 ;
}
//this is the main process
int try_receive(char * buf , int len )
{
if( !can_read())
return -1;
return SSL_read(m_ssl, buf, len);
}
-------------------------------------------------------------------------------
I'd really appreciate if you could tell me what's wrong with this code .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190921/7949ebf1/attachment.html>
More information about the openssl-users
mailing list