Class CUDPRelay Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: Custom Code in Header After Class DeclarationNext page: Custom Code in Source After Includes    Show member index
Custom Code in Header Private Section Declared in:
UDPRelay.h

'Custom Code' icon -- Shortcut to top of page. Custom Code

//Our listen socket
class CListenSocket : public CUDPSocketAsync
{
public:
    //Ctor and Dtor
    CListenSocket(CUDPRelay* pFather);
    virtual ~CListenSocket();
protected:
    //When socket has data in queue
    virtual BOOL OnSocketReceive(int iErrorCode);

    //No events
    NO_OnSocketOOB
    NO_OnSocketWrite
    NO_OnSocketTimeout
    NO_OnSocketConnect
    NO_OnSocketClose
    NO_OnSocketAccept
private:
    //Our father
    CUDPRelay* m_pFather;
};
//Our client socket
class CClientSocket : public CUDPSocketAsync
{
public:
    //Send data
    int SendData(const char* pBuffer,
                 unsigned long ulBufferSize);

    //Ctor and Dtor
    CClientSocket(CUDPRelay* pFather,
                  IP aSourceAddress,
                  unsigned short usSourcePort);
    virtual ~CClientSocket();
protected:
    //When socket has data in queue
    virtual BOOL OnSocketReceive(int iErrorCode);

    //When a timeout occured (implemented at library level)
    //User should return 0, if proccessed the message
    virtual BOOL OnSocketTimeout();

    //No events
    NO_OnSocketOOB
    NO_OnSocketWrite
    NO_OnSocketConnect
    NO_OnSocketClose
    NO_OnSocketAccept
private:
    //Our father
    CUDPRelay* m_pFather;

    //Source address
    IP m_aSourceAddress;

    //Source port
    unsigned short m_usSourcePort;

    //Our custome source port
    unsigned short m_usLocalPort;
};
//Our struct we use to ID an incoming connection
typedef struct _ConnectionData
{
    IP              aSourceIP;
    unsigned short  usSourcePort;

    //Compare operator
    bool operator<(const _ConnectionData& rData)const
    {
        if (aSourceIP==rData.aSourceIP)
            return usSourcePort<rData.usSourcePort;
        else
            return aSourceIP<rData.aSourceIP;
    }
} ConnectionData;

//Our map of connections
typedef std::map<ConnectionData,CClientSocket*> SocketMap;

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CRelay  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.