Set the socket options so that the timeout for outgoing packets is set to the supplied interval
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzTcpClient::SetSendTimeout | (uint32_t,) |
Declared in file: hzTcpClient.h
Defined in file : hzTcpClient.cpp
Function Logic:
Function body:
hzEcode hzTcpClient::SetSendTimeout (uint32_t nInterval)
{
// Set the socket options so that the timeout for outgoing 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
timeval tv ; // Timeout structure
tv.tv_sec = nInterval > 0? nInterval : 30;
tv.tv_usec = 0;
if (setsockopt(m_nSock, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0)
return E_HOSTFAIL ;
return E_OK ;
}