Class CSpoofBase::
InitializeSockets()
Data ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: GetNumberOfThreadsNext page: IsInitialized    Show member index
Public Function Declared in:
SpoofBase.h

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

static BOOL InitializeSockets(
    BOOL bMultiThreaded=FALSE,
    int iNumberOfThreads=0);

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

Initialize the sockets

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

//To avoid double initialize
if (m_Initialized)
    return TRUE;

try
{
#ifdef WIN32
    //Initialize the sockets
    WORD wVersionRequested;
    WSADATA wsaData;
    int err;

    wVersionRequested = MAKEWORD( 2, 2 );

    err = WSAStartup( wVersionRequested, &wsaData );
    if (err!=0)
        /* Tell the user that we could not find a usable */
        /* WinSock DLL.                                  */
        return FALSE;

    /* Confirm that the WinSock DLL supports 2.2.*/
    /* Note that if the DLL supports versions greater    */
    /* than 2.2 in addition to 2.2, it will still return */
    /* 2.2 in wVersion since that is the version we      */
    /* requested.                                        */

    if (LOBYTE(wsaData.wVersion)!=2 || HIBYTE(wsaData.wVersion)!=2)
    {
        /* Tell the user that we could not find a usable */
        /* WinSock DLL.                                  */
        WSACleanup();
        return FALSE;
    }

#endif
    //Save the threading information
    m_bMultiThreaded=bMultiThreaded;
    m_NumberOfThreads=iNumberOfThreads;

    //Create the critical section
    m_pCSection=COSManager::CreateCriticalSection();

    //And we are initialized
    m_Initialized=TRUE;

    return TRUE;
}
catch (...)
{
    return FALSE;
}

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

Class Overview Class Overview  |  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 © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.