Class CUDPRelay::
CreateSocket()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: CListenSocket::~CListenSocketNext page: CUDPRelay    Show member index
Private Function Declared in:
UDPRelay.h

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

CUDPRelay::CClientSocket * CreateSocket(
    IP aSourceAddress,
    unsigned short usSourcePort);

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

Create a socket

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

try
{
    //Create the socket
    CClientSocket* pSocket;
    pSocket=new CClientSocket(this,
                              aSourceAddress,
                              usSourcePort);

    //Protect the socket
    std::auto_ptr<CClientSocket> pProtection(pSocket);

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

        //Exit
        return NULL;
    }

    //Try to create it
    if (!pSocket->Listen())
    {
        //Report it
        ReportError("CreateSocket","Failed to create socket!");

        //Exit
        return NULL;
    }

    //Add the socket
    ConnectionData aData;
    aData.aSourceIP=aSourceAddress;
    aData.usSourcePort=usSourcePort;

    {
        //Lock
        CCriticalAutoRelease aRelease(m_pCSection);

        //Insert the socket
        m_aSocketMap.insert(SocketMap::value_type(aData,pSocket));
    }

    //Release the protection
    pProtection.release();

    //Done
    return pSocket;
}
ERROR_HANDLER_RETURN("CreateSocket",NULL)

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