本文整理汇总了C++中SocketClient::Connect方法的典型用法代码示例。如果您正苦于以下问题:C++ SocketClient::Connect方法的具体用法?C++ SocketClient::Connect怎么用?C++ SocketClient::Connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketClient
的用法示例。
在下文中一共展示了SocketClient::Connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WorkerThread
DWORD WINAPI ClientIOCP::WorkerThread(LPVOID lpObject)
{
SocketClient client;
char* reply;
int res = client.Connect(8085);
client.Send("This is a test\n", reply);
return 1;
}
示例2: ClientConnThreadProc
DWORD Worker::ClientConnThreadProc(void* p)
{
Worker* pThis = (Worker*)p;
bOrderEnd = false;
int nError;
pThis->m_pSocket = new SocketClient();
SocketClient* pSocketClient = (SocketClient*)pThis->m_pSocket;
//TODO: move this in Send / Receive Files Thread
//pThis->m_dataTransferer.SetSocket(pThis->m_pSocket);
nError = pSocketClient->Create();
if (nError)
{
DisplayError(nError);
bOrderEnd = 1;
goto final;
}
SendMessage(MainDlg::m_hStatusText, WM_SETTEXT, 0, (LPARAM)L"Connecting to the server...");
try_again:
nError = pSocketClient->Connect(14147);//was: 14148
if (nError && !bOrderEnd)
{
if (nError == WSAECONNREFUSED) {Sleep(200); goto try_again;}
if (nError != WSAETIMEDOUT)
{
DisplayError(nError);
bOrderEnd = 1;
goto final;
}
else
{