C++ common classes
General purpose classes for use across projects (Apache license)
|
Initiate a TCP client connection. More...
#include <Cpclient.h>
Public Member Functions | |
CPClient (CP_CONNECTION_HANDLER_ARRAY &cPCHandlers, CP_CLIENT_HANDLER_ARRAY &cPClientHandlers, int iMaxSendBufferSize=16384) | |
virtual | ~CPClient () |
virtual BOOL | ConnectToServer (LPCSTR lpszHostAddress, UINT nHostPort, DWORD dwTimeout=INFINITE, LPCSTR lpszClientAddress=NULL) |
Attempt to connect to the server. | |
virtual BOOL | AsyncConnectToServer (CPCLIENT_CALLBACK pUserFunc, void *pUserParm, LPCSTR lpszHostAddress, UINT nHostPort, DWORD dwTimeout=INFINITE, LPCSTR lpszClientAddress=NULL) |
An asynchronous attempt to connect to the server. | |
void | Disconnected () |
If you derive from this, be sure to call the CPClient::Disconnected in your derived method! | |
int | GetConnectionError () |
Get the last error. | |
Public Attributes | |
void * | pUserParm |
long | lConnectResponse |
Protected Member Functions | |
void | InstanceConnectCallback (BOOL bConnectResult) |
Same as the callback below, but on an instance instead of global level. | |
void | GetLastConnectAttemptParms (string &sHost, int &iPort) |
Get last connect attempt parameters. | |
Static Protected Member Functions | |
static void | ConnectCallback (CPClient *pClient, BOOL bConnectResult) |
Callback. | |
static void | InternalCallback (CPClient *pClient, BOOL bConnectResult, void *) |
Protected Attributes | |
CP_CLIENT_HANDLER_ARRAY | cClientHandlers |
Array of CPClientHandlers using for making connections. | |
int | iNumClientHandlers |
CP_CONNECTION_HANDLER_ARRAY | cConnectionHandlers |
Array of CPConnectionHandlers. Used for servicing successful connetions. | |
int | iNumConnHandlers |
CXPlatEvent | cConnectedEvent |
Set when success or failure. | |
unsigned long | ulAttemptTS |
Timestamp when the attempt started. | |
CPCLIENT_CALLBACK | pCPLFunc |
User callback function. | |
void * | pUserConnectParm |
unsigned long | ulTimeout |
int | iConnectError |
string | sLastHost |
int | iLastPort |
long | lStartTime |
string | sServer |
Initiate a TCP client connection.
Definition at line 39 of file Cpclient.h.
CPClient::CPClient | ( | CP_CONNECTION_HANDLER_ARRAY & | cPCHandlers, |
CP_CLIENT_HANDLER_ARRAY & | cPClientHandlers, | ||
int | iMaxSendBufferSize = 16384 |
||
) |
Definition at line 27 of file Cpclient.cpp.
CPClient::~CPClient | ( | ) | [virtual] |
Definition at line 39 of file Cpclient.cpp.
BOOL CPClient::AsyncConnectToServer | ( | CPCLIENT_CALLBACK | pUserFunc, |
void * | pUserParm, | ||
LPCSTR | lpszHostAddress, | ||
UINT | nHostPort, | ||
DWORD | dwTimeout = INFINITE , |
||
LPCSTR | lpszClientAddress = NULL |
||
) | [virtual] |
An asynchronous attempt to connect to the server.
Definition at line 72 of file Cpclient.cpp.
void CPClient::ConnectCallback | ( | CPClient * | pClient, |
BOOL | bConnectResult | ||
) | [static, protected] |
Callback.
Definition at line 218 of file Cpclient.cpp.
BOOL CPClient::ConnectToServer | ( | LPCSTR | lpszHostAddress, |
UINT | nHostPort, | ||
DWORD | dwTimeout = INFINITE , |
||
LPCSTR | lpszClientAddress = NULL |
||
) | [virtual] |
Attempt to connect to the server.
Definition at line 45 of file Cpclient.cpp.
void CPClient::Disconnected | ( | ) | [virtual] |
If you derive from this, be sure to call the CPClient::Disconnected in your derived method!
Reimplemented from CPConnection.
Definition at line 225 of file Cpclient.cpp.
int CPClient::GetConnectionError | ( | ) |
Get the last error.
Definition at line 232 of file Cpclient.cpp.
void CPClient::GetLastConnectAttemptParms | ( | string & | sHost, |
int & | iPort | ||
) | [protected] |
Get last connect attempt parameters.
Definition at line 239 of file Cpclient.cpp.
void CPClient::InstanceConnectCallback | ( | BOOL | bConnectResult | ) | [protected] |
Same as the callback below, but on an instance instead of global level.
Definition at line 175 of file Cpclient.cpp.
void CPClient::InternalCallback | ( | CPClient * | pClient, |
BOOL | bConnectResult, | ||
void * | |||
) | [static, protected] |
Definition at line 247 of file Cpclient.cpp.
CP_CLIENT_HANDLER_ARRAY CPClient::cClientHandlers [protected] |
Array of CPClientHandlers using for making connections.
Definition at line 85 of file Cpclient.h.
CXPlatEvent CPClient::cConnectedEvent [protected] |
Set when success or failure.
Definition at line 91 of file Cpclient.h.
Array of CPConnectionHandlers. Used for servicing successful connetions.
Definition at line 88 of file Cpclient.h.
int CPClient::iConnectError [protected] |
Definition at line 98 of file Cpclient.h.
int CPClient::iLastPort [protected] |
Definition at line 100 of file Cpclient.h.
int CPClient::iNumClientHandlers [protected] |
Definition at line 86 of file Cpclient.h.
int CPClient::iNumConnHandlers [protected] |
Definition at line 89 of file Cpclient.h.
Definition at line 81 of file Cpclient.h.
long CPClient::lStartTime [protected] |
Definition at line 101 of file Cpclient.h.
CPCLIENT_CALLBACK CPClient::pCPLFunc [protected] |
User callback function.
Definition at line 95 of file Cpclient.h.
void* CPClient::pUserConnectParm [protected] |
Definition at line 96 of file Cpclient.h.
Definition at line 80 of file Cpclient.h.
string CPClient::sLastHost [protected] |
Definition at line 99 of file Cpclient.h.
string CPClient::sServer [protected] |
Definition at line 102 of file Cpclient.h.
unsigned long CPClient::ulAttemptTS [protected] |
Timestamp when the attempt started.
Definition at line 93 of file Cpclient.h.
unsigned long CPClient::ulTimeout [protected] |
Definition at line 97 of file Cpclient.h.