Return TypeFunction nameArguments
hzEcodehzTcpClient::Recv(void*,unsigned int&,unsigned int,)

Declared in file: hzTcpClient.h
Defined in file : hzTcpClient.cpp

Function Logic:

0:START 1:cpOut cpOut nRecv 2:!m_nSock 3:Return E_NOSOCKET 4:nMax==0 5:Return E_OK 6:m_pSSL 7:SSL_read nBytes 8:recv nBytes 9:nBytes<0 10:errno==EAGAIN 11:Return E_OK 12:errno==ETIMEDOUT 13:Return E_TIMEOUT 14:Return E_RECVFAIL 15:nRecv 16:Return E_OK

Function body:

hzEcode hzTcpClient::Recv (void* vpOut, unsigned int& nRecv, unsigned int nMax)
{
   _hzfunc("hzTcpClient::Recv(1)") ;
   char*   cpOut ;
   int32_t nBytes ;
   cpOut = (char*) vpOut ;
   cpOut[0]= 0;
   nRecv = 0;
   if (!m_nSock)
       return E_NOSOCKET ;
   if (nMax == 0)
       return E_OK ;
   if (m_pSSL)
       nBytes = SSL_read(m_pSSL, cpOut, nMax) ;
   else
       nBytes = recv(m_nSock, cpOut, nMax, 0);
   if (nBytes < 0)
   {
       if (errno == EAGAIN)    return E_OK ;
       if (errno == ETIMEDOUT) return E_TIMEOUT ;
       return E_RECVFAIL ;
   }
   nRecv = nBytes ;
   return E_OK ;
}