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

📄 gamesocket.cpp

📁 一个局域网的五子棋程序
💻 CPP
字号:
// GameSocket.cpp : implementation file
//

#include "stdafx.h"
#include "wuzi.h"
#include "GameSocket.h"
#include "wuziDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGameSocket

CGameSocket::CGameSocket()
{
	m_pdlg=NULL;
}

CGameSocket::~CGameSocket()
{
	m_pdlg=NULL;
}


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

/////////////////////////////////////////////////////////////////////////////
// CGameSocket member functions

void CGameSocket::OnAccept(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(nErrorCode==0)
		m_pdlg->OnAccept();
	//CAsyncSocket::OnAccept(nErrorCode);
}

void CGameSocket::OnClose(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(nErrorCode==0)
	{
		AfxMessageBox("对方已断开连接");
		m_pdlg->OnClose();
	}
	//CAsyncSocket::OnClose(nErrorCode);
}

void CGameSocket::OnConnect(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(nErrorCode==0)
	{
		
		m_pdlg->IsConnect(true);
			
	}
	else
	{
		m_pdlg->IsConnect(false);
	}
       
	//CAsyncSocket::OnConnect(nErrorCode);
}

void CGameSocket::OnReceive(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(nErrorCode==0)
		m_pdlg->OnReceive();
	//CAsyncSocket::OnReceive(nErrorCode);
}



void CGameSocket::SetParent(CWuziDlg *pDlg)
{
m_pdlg=pDlg;
}

⌨️ 快捷键说明

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