mysock.cpp

来自「MFC网络编程源代码」· C++ 代码 · 共 92 行

CPP
92
字号
// MySock.cpp : implementation file
//

#include "stdafx.h"
#include "WinSock.h"
#include "MySock.h"
#include "WinSockDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMySock

CMySock::CMySock()
{
}

CMySock::~CMySock()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CMySock member functions

void CMySock::SetParent(CDialog *pWnd)
{
	m_pWnd = pWnd;
}

void CMySock::OnAccept(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class

	if(nErrorCode == 0)
		((CWinSockDlg*)m_pWnd)->OnAccept();
	
	CAsyncSocket::OnAccept(nErrorCode);
}

void CMySock::OnClose(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class

	if(nErrorCode == 0)
		((CWinSockDlg*)m_pWnd)->OnClose();
	
	CAsyncSocket::OnClose(nErrorCode);
}

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

	if(nErrorCode == 0)
		((CWinSockDlg*)m_pWnd)->OnConnect();
	
	CAsyncSocket::OnConnect(nErrorCode);
}

void CMySock::OnReceive(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	if(nErrorCode == 0)
		((CWinSockDlg*)m_pWnd)->OnReceive();

	CAsyncSocket::OnReceive(nErrorCode);
}

void CMySock::OnSend(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class

	if(nErrorCode == 0)
		((CWinSockDlg*)m_pWnd)->OnSend();
	
	CAsyncSocket::OnSend(nErrorCode);
}

⌨️ 快捷键说明

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