Set the socket options so that the timeout for receiving packets is set to the supplied interval

Return TypeFunction nameArguments
hzEcodehzTcpClient::SetRecvTimeout(uint32_t,)

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

Function Logic:

0:START 1:items tv 2:unknown 3:Return E_HOSTFAIL 4:Return E_OK

Function body:

hzEcode hzTcpClient::SetRecvTimeout (uint32_t nInterval)
{
   //  Set the socket options so that the timeout for receiving packets is set to the supplied interval
   //  
   //  Arguments: 1) nInterval Timeout interval in seconds
   //  
   //  Returns: E_HOSTFAIL If the timeout could not be set
   //     E_OK  If the timeout was successfully set
   struct timeval  tv ;    //  Timeout structure
   tv.tv_sec = nInterval > 0? nInterval : 30;
   tv.tv_usec = 0;
   if (setsockopt(m_nSock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
       return E_HOSTFAIL ;
   return E_OK ;
}