Defined in file: hzProcess.h

The hzTcpClient manages a TCP client connection to a local or remote service. This may be to any legal port and opperate using any protocol.

Constructors/Detructors

hzTcpClient*hzTcpClient(void)
void~hzTcpClient(void)

Public Methods:

voidClose(void)Closes the client TCP connection. If there is an SSL connection, this is shutdown and then the handle for the SSL is freed. Arguments: None Returns: None
hzEcodeConnectIP(hzIpaddr& ipa)uint32_t nPort, uint32_t nTimeoutR, uint32_t nTimeoutS, Establish a standard, non-local, non-SSL TCP connection to a server at a known IP address.
hzEcodeConnectLoc(uint32_t nPort)Purpose: Establish a UNIX domain TCP connection to a server
hzEcodeConnectSSL(const char* hostname)uint32_t nPort, uint32_t nTimeoutR, uint32_t nTimeoutS, Purpose: Establish an SSL TCP connection to a server
hzEcodeConnectStd(const char* hostname)uint32_t nPort, uint32_t nTimeoutR, uint32_t nTimeoutS, Establish a standard, non-local, non-SSL TCP connection to a server. Note that to re-connect in the event of a drop-out, just call this function again. A subsequent call will not repeat the DNS query unless it is to a different hostname. Note also that this function will do nothing if called with the same hostname, no error flag has been set and the socket is non-zero. The error flag is set by send or recv errors.
char*GetBuffer(void)
hzEcodeRecv(void* vpOut)uint32_t& nRecv, uint32_t nMax, Purpose: Read from a socket into a buffer.
hzEcodeRecv(hzChain& Z)Purpose: Read from a socket into the supplied chain. The function terminates when no more bytes can be read from the socket.
hzEcodeSend(const void* pIn)uint32_t nLen, Purpose: Write buffer content to a socket
hzEcodeSend(hzChain& C)Purpose: Write chain content to a socket
voidSetDebug(bool bDebug)
hzEcodeSetRecvTimeout(uint32_t nInterval)Set the socket options so that the timeout for receiving packets is set to the supplied interval
hzEcodeSetSendTimeout(uint32_t nInterval)Set the socket options so that the timeout for outgoing packets is set to the supplied interval
voidShow(hzChain& Z)Diagnostic purposes. Show details for host if currently connected Returns: None
uint32_tSock(void)

Member Variables:

char*m_BufInternal buffer for I/O
hzStringm_HostnameHostname (for diagnostics)
hzIpaddrm_IpaIP address of host
sockaddr_inm_SvrAddraddress of server
boolm_bDebugDebug mode on (extra logs)
boolm_bErrorSend/Recv failed. Must re-connect
boolm_bSSLConnection will be SSL
uint32_tm_nBytesRecvBytes received
uint32_tm_nPortPort
uint32_tm_nSockClient socket given by server
uint32_tm_nTimeoutRRecv timeout
uint32_tm_nTimeoutSSend timeout
hostent*m_pHostthe server
SSL*m_pSSLSSL entity for SSL connections