Class KomodiaDNS::CDNSSocket::
Initialize()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: GetThreadManagerNext page: operator =    Show member index
Public Function Declared in:
DNSSocket.h

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

BOOL Initialize();

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

Initialize data

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

try
{
    //Initialize our sockets
    //if TCP
    if (m_bUseTCP)
    {
        //Do we have the socket
        if (m_pTCP)
            delete m_pTCP;

        //Create the socket
        m_pTCP=new CDNSTCPSocket(this);

        //Try to create it
        if (!m_pTCP->Create())
        {
            //Write the error
            ReportError("Initialize","Failed to create socket!");

            //Exit
            return FALSE;
        }

        //Set the blocking mode
        if (!m_bAsync)
            if (!m_pTCP->ReBlock())
            {
                //Write an error
                ReportError("Initialize","Failed to switch socket to blocking mode!");

                //And exit
                return FALSE;
            }
            else
                ;
        else
            //Set it to have buffer
            m_pTCP->AllowBlockedBuffer(TRUE);
    }
    else
    {
        //Do we have it
        if (m_pUDP)
            delete m_pUDP;

        //Create the socket
        m_pUDP=new CDNSUDPSocket(this);

        //Try to create it
        if (!m_pUDP->Create())
        {
            //Write the error
            ReportError("Initialize","Failed to create socket!");

            //Exit
            return FALSE;
        }

        //Set the blocking mode
        if (!m_bAsync)
            if (!m_pUDP->ReBlock())
            {
                //Write an error
                ReportError("Initialize","Failed to switch socket to blocking mode!");

                //And exit
                return FALSE;
            }
            else
                ;
        else
            if (!m_pUDP->Listen())
            {
                //Write an error
                ReportError("Initialize","Failed to listen on socket to blocking mode!");

                //And exit
                return FALSE;
            }
    }

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

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

Class Overview Class Overview  |  Public base class CErrorHandler  |  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.