serverprocess.cpp

来自「iocp vc例子,自己是学DELPHI」· C++ 代码 · 共 106 行

CPP
106
字号
// ServerProcess.cpp: implementation of the CServerProcess class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ZNetServer.h"
#include "ZNetServerDlg.h"
#include "ServerProcess.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CServerProcess::CServerProcess()
{
	m_pServerDialog = NULL;
}

CServerProcess::~CServerProcess()
{

}

int CServerProcess::ProcessNewConnection(CIocpContext* pContext)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->ProcessNewConnection(pContext);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessDisConnection(SOCKET soSocket)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->ProcessDisConnection(soSocket);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessPacketBegin(SOCKET soSocket, CIocpPacket* pPacket)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->m_dlgProgress.ProcessPacketBegin(soSocket, pPacket);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessPacketProgress(SOCKET soSocket, ULONG ulKey, WPARAM wParam, LPARAM lParam)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->m_dlgProgress.ProcessPacketProgress(soSocket, ulKey, wParam, lParam);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessPacketEnd(SOCKET soSocket, CIocpPacket* pPacket)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->m_dlgProgress.ProcessPacketEnd(soSocket, pPacket);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessPacket(SOCKET soSocket, CIocpPacket* pPacket)
{
	int nErr=CIocpProcess::ProcessPacket(soSocket, pPacket);
	if (!NOERROROCCUR(nErr) && m_pServerDialog!=NULL)
	{
		m_pServerDialog->ProcessPacket(soSocket, pPacket);
		nErr = ERROR_NONE;
	}
	return nErr;
}

int CServerProcess::ProcessPacketCancel(SOCKET soSocket, ULONG ulKey)
{
	int nErr=ERROR_IOCPPROCESS_NOT_DONE;
	if (m_pServerDialog!=NULL)
	{
		m_pServerDialog->m_dlgProgress.ProcessPacketCancel(soSocket, ulKey);
		nErr = ERROR_NONE;
	}
	return nErr;
}

⌨️ 快捷键说明

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