Class CUDPRelay::
Relay()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: RelayNext page: RemoveSocket    Show member index
Public Function Declared in:
UDPRelay.h

'Declaration' icon -- Shortcut to top of page. Declaration

virtual BOOL Relay(
    IP aBindAddress,
    unsigned short usBindPort,
    IP aDestinationAddress,
    unsigned short usDestinationPort);

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    //Are we created?
    if (m_bCreated)
    {
        //Report it
        ReportError("Relay","Already created!");

        //Exit
        return FALSE;
    }

    //Create the socket
    m_pSocket=new CListenSocket(this);

    //Protect it
    std::auto_ptr<CListenSocket> pProtection(m_pSocket);

    //Try to create it
    if (!m_pSocket->Create())
    {
        //Report it
        ReportError("Relay","Failed to create socket!");

        //Exit
        return FALSE;
    }

    //Try to bind it
    if (!m_pSocket->Bind(aBindAddress,
                         usBindPort))
    {
        //Report it
        ReportError("Relay","Failed to create socket!");

        //Exit
        return FALSE;
    }

    //Save the data
    m_aTarget=aDestinationAddress;
    m_usTargetPort=usDestinationPort;
    m_usBindPort=usBindPort;

    //Set local port
    m_usLocalPort=1024;

    //Try to listen
    if (!m_pSocket->Listen())
    {
        //Report it
        ReportError("Relay","Failed to listen!");

        //Exit
        return FALSE;
    }

    //Remove protection
    pProtection.release();

    //We are done
    m_bCreated=TRUE;

    //Done
    return TRUE;
}
ERROR_HANDLER_RETURN("Relay",FALSE)

'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.