chenluhua1980
2026-01-24 8fc148424accf484b4f331c7d5fb11eb7383cf89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <afxSock.h>
#include <functional>
 
namespace BEQ {
    typedef std::function<int(void* pClient, const char* pData, int nLen)> ONREAD;
    typedef std::function<int(void* pClient)> ONCLOSE;
 
    typedef struct _AcceptClientListener
    {
        ONREAD            onRead;
        ONCLOSE            onClose;
    } AcceptClientListener;
 
    class CAcceptClient :
        public CAsyncSocket
    {
    public:
        CAcceptClient();
        ~CAcceptClient();
 
    public:
        void setListener(AcceptClientListener listener);
        virtual void OnClose(int nErrorCode);
        virtual void OnReceive(int nErrorCode);
 
    private:
        AcceptClientListener m_listener;
 
    public:
        void* m_pContext1;
        void* m_pContext2;
        void* m_pContext3;
        void* m_pContext4;
    };
}