socketreceivethread.cpp

来自「Cisco CVP 的Call Serve与第3方CTI的通信协议」· C++ 代码 · 共 64 行

CPP
64
字号
// SocketReceiveThread.cpp : implementation file
//

#include "stdafx.h"
#include "SocketReceiveThread.h"
#include "SocketControl.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSocketReceiveThread

IMPLEMENT_DYNCREATE(CSocketReceiveThread, CWinThread)

CSocketReceiveThread::CSocketReceiveThread()
{
}
CSocketReceiveThread::CSocketReceiveThread(CSocketControl* _control)
{
	m_control=_control;
}
CSocketReceiveThread::~CSocketReceiveThread()
{
}

BOOL CSocketReceiveThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int CSocketReceiveThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	SetEvent(m_event);
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CSocketReceiveThread, CWinThread)
	//{{AFX_MSG_MAP(CSocketReceiveThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_THREAD_MESSAGE(WM_RECV_SOCKET,OnRecvSocket)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSocketReceiveThread message handlers
void ShowMsg(CString msg);

void CSocketReceiveThread::OnRecvSocket(WPARAM wp,LPARAM lp)
{
	int tindex=(int)wp;
	CONN* conn=(CONN*)lp;
	m_control->m_handledatafuction(conn->m_socket);
	conn->m_actiontag=0;
	m_control->removeconn(conn->m_socket,false);	
	SetEvent(m_control->m_recvevents[tindex]);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?