connects.cpp

来自「組态软件设计与开发的配套源代码」· C++ 代码 · 共 65 行

CPP
65
字号
/////////////////////////////////////////////////////////////////////////////
//	Author				:	Bala Murali
//	ConnectS.cpp		:	implementation file
//	Creation Date		:	03/09/2000
//	Version				:	Initial Release
/////////////////////////////////////////////////////////////////////////////



#include "stdafx.h"
#include "XSockServer.h"
#include "ConnectS.h"
#include "XSockServerCtl.h"

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


extern CXSockServerCtrl* m_pControl;
long CConnectS::m_lObjectCount = 0;

/////////////////////////////////////////////////////////////////////////////
// CConnectS

CConnectS::CConnectS()
{
	m_lObjectCount++;
	m_lChildId = m_lObjectCount;
}

CConnectS::~CConnectS()
{
}


// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CConnectS, CAsyncSocket)
	//{{AFX_MSG_MAP(CConnectS)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif	// 0

/////////////////////////////////////////////////////////////////////////////
// CConnectS member functions

void CConnectS::OnClose(int nErrorCode) 
{
	m_pControl->FireOnClose(m_lChildId);
}


void CConnectS::OnReceive(int nErrorCode) 
{
	int iByteLen = Receive((void*)m_pControl->m_lpBuff,m_pControl->m_nBuffLen);
	if ( m_pControl->m_bNullTerminate )
		m_pControl->m_lpBuff[iByteLen++] = NULL;

	m_pControl->FireOnReceive(m_lChildId,m_pControl->m_lpBuff,iByteLen);
}

⌨️ 快捷键说明

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