Receive a packet of data from the client socket and append it to the input chain. Scope: This function should not be called by the application!

Return TypeFunction nameArguments
int32_thzIpConnex::Recv(hzPacket&,)

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

Function Logic:

0:START 1:unknown 2:m_nsRecvBeg 3:unknown 4:nRecv 5:nRecv 6:unknown 7:m_bState 8:unknown 9:m_nTotalIn m_bState items 10:m_nsRecvEnd 11:Return nRecv

Function body:

int32_t hzIpConnex::Recv (hzPacket& tbuf)
{
   //  Category: Internet Server
   //  
   //  Receive a packet of data from the client socket and append it to the input chain.
   //  
   //  Arguments: 1) tbuf  The recepticle (buffer) for reading the socket.
   //  
   //  Returns: Total number of bytes read
   //  
   //  Scope:  This function should not be called by the application!
   _hzfunc("hzIpConnex::Recv") ;
   int32_t     nRecv ;     //  Bytes recieved
   if (!m_Input.Size())
       m_nsRecvBeg = RealtimeNano() ;
   if (m_pSSL)
       nRecv = SSL_read(m_pSSL, tbuf.m_data, HZ_MAXPACKET) ;
   else
       nRecv = recv(m_nSock, tbuf.m_data, HZ_MAXPACKET, 0);
   if (!nRecv)
       m_bState |= CLIENT_TERMINATION ;
   if (nRecv > 0)
   {
       m_nTotalIn += nRecv ;
       m_bState |= CLIENT_READING ;
       m_Input.Append(tbuf.m_data, nRecv) ;
   }
   m_nsRecvEnd = RealtimeNano() ;
   return nRecv ;
}