⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netreceivers.h

📁 用UDP写的可靠传输程序源代码,非常有借鉴意义,适合互连网通讯
💻 H
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -