netreceivers.h

来自「用UDP写的可靠传输程序源代码,非常有借鉴意义,适合互连网通讯」· C头文件 代码 · 共 64 行

H
64
字号
// CCTPNetReceiver - CTP reciever
// CTCPNetReceiver - TCP reciever
// CUDPNetReceiver - UDP reciever
// They partly duplicate each other to allow to customize support of every
// protocol easily
// Declaration file
//
// (c) Lev Naumov, CAMEL Laboratory
// E-mail: camellab@mail.ru
// For more information see http://camel.ifmo.ru or
// http://www.codeproject.com/internet/ctp.asp
/////////////////////////////////////////////////////////////////////////////

class CCTPNetReceiver: public NetReceiver
{
public:
    // Constructor. Parameter mainwnd is a pointer to main applications window
    CCTPNetReceiver(CWnd* mainwnd) {m_pMainWnd=mainwnd;};

    // Is called when have received data pointed by data
    virtual void OnReceive(void* data);

    // Is called when there was an error, described with data pointed by data
    virtual void OnError(void* data);

protected:
    // Pointer to main applications window
    CWnd* m_pMainWnd;
};

class CTCPNetReceiver: public NetReceiver
{
public:
    // Constructor. Parameter mainwnd is a pointer to main applications window
    CTCPNetReceiver(CWnd* mainwnd) {m_pMainWnd=mainwnd;};

    // Is called when have received data pointed by data
    virtual void OnReceive(void* data);

    // Is called when there was an error, described with data pointed by data
    virtual void OnError(void* data);

protected:
    // Pointer to main applications window
    CWnd* m_pMainWnd;
};

class CUDPNetReceiver: public NetReceiver
{
public:
    // Constructor. Parameter mainwnd is a pointer to main applications window
    CUDPNetReceiver(CWnd* mainwnd) {m_pMainWnd=mainwnd;};

    // Is called when have received data pointed by data
    virtual void OnReceive(void* data);

    // Is called when there was an error, described with data pointed by data
    virtual void OnError(void* data);

protected:
    // Pointer to main applications window
    CWnd* m_pMainWnd;
};

⌨️ 快捷键说明

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