netsocket.cpp

来自「用算法来实现一个收费系统」· C++ 代码 · 共 87 行

CPP
87
字号
// NetSocket.cpp : implementation file
//

#include "stdafx.h"
#include "mainfrm.h"
#include "LaneSoft.h"
#include "NetSocket.h"
#include "NetComManger.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNetSocket
extern	BOOL m_BClose;
CNetSocket::CNetSocket(CNetComManger * pManger)
{
	m_pManger = pManger;
	m_BClose = TRUE;
}

CNetSocket::~CNetSocket()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CNetSocket member functions

void CNetSocket::OnReceive(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	m_pManger->FetchMsg(this);

	CSocket::OnReceive(nErrorCode);
}

void CNetSocket::OnClose(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
//	m_BClose = true;
	m_pManger->OnConnectClose() ;
	CSocket::OnClose(nErrorCode);
}

void CNetSocket::OnOutOfBandData(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CSocket::OnOutOfBandData(nErrorCode);
}

BOOL CNetSocket::OnMessagePending() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CSocket::OnMessagePending();
}

void CNetSocket::OnConnect(int nErrorCode) 
{
	
// TODO: Add your specialized code here and/or call the base class
		CSocket::OnConnect(nErrorCode);
}

BOOL CNetSocket::IsClose()
{
	return m_BClose;
}

void CNetSocket::HaveConnect()
{
	m_BClose = false;
}

⌨️ 快捷键说明

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