Click here to Skip to main content
15,893,564 members
Articles / High Performance Computing / Parallel Processing

Commands Transfer Protocol (CTP) - A New Networking Protocol for Distributed or Parallel Computations

Rate me:
Please Sign up or sign in to vote.
4.85/5 (33 votes)
2 Feb 200522 min read 228.4K   7.6K   132  
In this article, an improved version of a new networking protocol for distributed or parallel computations is presented. In common, it is suitable just for fast, reliable and featureful interchange of small messages. The protocol's implementation and demo project are provided.
// 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;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
dum
Web Developer
Russian Federation Russian Federation
Lev Naumov.
MSc in Computer Science. Graduated from Computer Technologies Department of Saint-Petersburg State University of Information Technologies, Mechanics and Optics.
Worked as C/C++ and Java programmer. Now - the research worker in "CAMEL Laboratory" and PhD student in Computer Technologies Department of Saint-Petersburg State University of Information Technologies, Mechanics and Optics.
Has scientific achievements in field of physics, automata theory, cellular automata theory, cluster computing. There are some publications.

Comments and Discussions