Class CUDPRelay::
CClientSocket::OnSocketReceive()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: CClientSocket::CClientSocketNext page: CClientSocket::OnSocketTimeout    Show member index
Private Function
(Not Declared)
Declared in:
UDPRelay.h

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

BOOL CClientSocket::OnSocketReceive(
    int iErrorCode);

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

try
{
    if (iErrorCode)
    {
        //Report it
        ReportError("OnSocketReceive","Received an error code!",iErrorCode);

        //Done
        return FALSE;
    }

    //Do we have a timer
    if (m_pFather->GetTimeout())
        //Set it
        if (!SetTimeout(m_pFather->GetTimeout()))
            //Report it
            ReportError("OnSocketReceive","Failed to set timeout!");

    char cBuffer[65536];

    //Data information
    IP aIP;
    unsigned short usPort;

    //Get the data
    int iResult;
    iResult=Receive(cBuffer,
                    sizeof(cBuffer),
                    aIP,
                    usPort);

    //Did we receive anything?
    if (iResult>0)
    {
        //Get the socket
        CListenSocket* pSocket;
        pSocket=m_pFather->m_pSocket;

        //Send the data
        if (pSocket &&
            pSocket->Send(m_aSourceAddress,
                          m_usSourcePort,
                          cBuffer,
                          iResult)<=0)
            //Report the error
            ReportError("OnSocketReceive","Failed to send data!");
        else
            return TRUE;
    }
    else
        //Report the error
        ReportErrorOS("OnSocketReceive","Failed to receive data!");

    //Done
    return FALSE;
}
ERROR_HANDLER_RETURN("OnSocketReceive",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.