⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverprocess.cpp

📁 iocp vc例子,自己是学DELPHI
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -