listen.cpp

来自「一个网路服务器程序」· C++ 代码 · 共 43 行

CPP
43
字号
// Listen.cpp : implementation of the CListSocket class
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include "stdafx.h"
#include "Listen.h"
#include "ReqSock.h"
#include "HttpDoc.h"

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

IMPLEMENT_DYNCREATE(CListenSocket, CAsyncSocket)

CListenSocket::CListenSocket( void )
{
	m_pDoc = NULL;
}

CListenSocket::CListenSocket( CHttpSvrDoc* pDoc )
{
	m_pDoc = pDoc;
}

void CListenSocket::OnAccept( int /*nErrorCode*/ )
{
	CRequestSocket* pRequest = new CRequestSocket( m_pDoc );
	if ( Accept( *pRequest ) )
	{
		pRequest->AsyncSelect( FD_READ|FD_CLOSE );
	}
}

⌨️ 快捷键说明

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