My client can not receive data in blocking mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello
 
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 .

------------------------------------------------------------------------------
bool can_read()
{
      if(SSL_pending(m_ssl))
            return true;
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);
}
-------------------------------------------------------------------------------
 Above is my code ,  my program get `false` from `can_read` although the server has sent response data
 I really appreciate your help.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux