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 Type | Function name | Arguments |
|---|---|---|
| int32_t | hzIpConnex::Recv | (hzPacket&,) |
Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp
Function Logic:
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 ;
}