Class CUDPRelay::
SendData()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: RemoveSocketNext page: Stop    Show member index
Private Function Declared in:
UDPRelay.h

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

void SendData(
    const char* pBuffer,
    unsigned long ulBufferSize,
    IP aDestinationIP,
    unsigned short usDestinationPort);

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

Send data

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

try
{
    //Search for the socket
    ConnectionData aData;
    aData.aSourceIP=aDestinationIP;
    aData.usSourcePort=usDestinationPort;

    //The socket
    CClientSocket* pSocket;
    pSocket=NULL;

    {
        //Lock the data
        CCriticalAutoRelease aRelease(m_pCSection);

        //Do we have it
        SocketMap::iterator aIterator;
        aIterator=m_aSocketMap.find(aData);
        if (aIterator!=m_aSocketMap.end())
            //Save the socket
            pSocket=aIterator->second;
    }

    //Do we have the socket
    if (pSocket)
        //Send the data
        if (pSocket->SendData(pBuffer,
                              ulBufferSize)<=0)
            //Report it
            ReportErrorOS("SendData","Failed to send data!");
        else
            ;
    else
    {
        //Create the socket
        if (!(pSocket=CreateSocket(aDestinationIP,
                                   usDestinationPort)))
            //Report it
            ReportError("CreateSocket","Failed to create socket!");
        else
            //Recall ourselves
            SendData(pBuffer,
                     ulBufferSize,
                     aDestinationIP,
                     usDestinationPort);
    }
}
ERROR_HANDLER("SendData")

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