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

📄 connects.cpp

📁 基于组态开发的VC源码
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
//	Author				:	Bala Murali
//	ConnectS.cpp		:	implementation file
//	Creation Date		:	03/09/2000
//	Version				:	Initial Release
/////////////////////////////////////////////////////////////////////////////



#include "stdafx.h"
#include "XSockClient.h"
#include "ConnectS.h"
#include "XSockClientCtl.h"

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


extern CXSockClientCtrl* m_pControl;


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

CConnectS::CConnectS()
{
}

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->m_bConnect = FALSE;
	m_pControl->m_ConnectS.Close();
	m_pControl->FireOnClose();
}

void CConnectS::OnConnect(int nErrorCode) 
{
	if ( 0 != nErrorCode )
	{
		m_pControl->m_bConnect = FALSE;
		m_pControl->SocketError(nErrorCode);
		return;
	}

	m_pControl->FireOnConnect();
}

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_pControl->m_lpBuff,iByteLen);
}

void CConnectS::OnSend(int nErrorCode) 
{
	m_pControl->FireOnSend();
}

⌨️ 快捷键说明

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