📄 socketreceivethread.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -