serversocket.cpp

来自「Visual C++_Turbo C串口通信编程实践(第2版)- 龚建伟, 熊光」· C++ 代码 · 共 48 行

CPP
48
字号
// ServerSocket.cpp : implementation file
//

#include "stdafx.h"
#include "MyQQServer.h"
#include "ServerSocket.h"
#include "ClientSocket.h"

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

/////////////////////////////////////////////////////////////////////////////
// ServerSocket

ServerSocket::ServerSocket()
{
}

ServerSocket::~ServerSocket()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// ServerSocket member functions

void ServerSocket::OnAccept(int nErrorCode) 
{
	// TODO: Add your specialized code here and/or call the base class
	CClientSocket * m_pNewClient = new CClientSocket(); //创建Socket处理连接
	ASSERT(m_pNewClient != NULL);
	Accept(*m_pNewClient);


	CSocket::OnAccept(nErrorCode);
}

⌨️ 快捷键说明

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