Beispiel #1
0
void CTCPManager::HandleEvent ( unsigned int uiID, LPARAM lType )
{
    // Call the CTCP socket's event handler that's associated with the uiID argument
    if ( m_pSocket[uiID] != NULL )
    {
        // We know it's a derived class for sure.. so static_cast it without any error checking
        CTCPClientSocketImpl* pSocket = static_cast < CTCPClientSocketImpl* > ( m_pSocket[uiID] );
        pSocket->FireEvent ( lType );
    }
}
Beispiel #2
0
void CTCPManager::HandleEvent ( unsigned int uiInID, WPARAM wParam, LPARAM lType )
{
    uint uiID = uiInID & 255;
    bool bIsResolveEvent = ( uiInID & 256 ) != 0;

    // Call the CTCP socket's event handler that's associated with the uiID argument
    if ( m_pSocket[ uiID ] != NULL )
    {
        // We know it's a derived class for sure.. so static_cast it without any error checking
        CTCPClientSocketImpl* pSocket = static_cast < CTCPClientSocketImpl* > ( m_pSocket[ uiID ] );
        pSocket->FireEvent ( bIsResolveEvent, wParam, lType );
    }
}
Beispiel #3
0
CTCPClientSocket* CTCPImpl::CreateClient ( void )
{
    // Create the socket and initialize it
    CTCPClientSocketImpl* pSocket = new CTCPClientSocketImpl;
    if ( !pSocket->Initialize () )
    {
        // Copy the error details, delete it and return NULL
        strcpy ( m_szLastError, pSocket->GetLastError () );
        delete pSocket;
        return 0;
    }

    // Return the socket we created
    return pSocket;
}
Beispiel #4
0
CTCPClientSocket* CTCPManager::CreateClient ( void )
{
    for ( unsigned int i = 0; i < 255; i++ )
    {
        // Check for an empty socket pointer slot
        if ( m_pSocket[i] == NULL )
        {
            // Create the socket and initialize it
            CTCPClientSocketImpl* pSocket = new CTCPClientSocketImpl;
            if ( !pSocket->Initialize ( i ) )
            {
                // Copy the error details, delete it and return NULL
                strcpy ( m_szLastError, pSocket->GetLastError () );
                SAFE_RELEASE ( pSocket )
                return NULL;
            }
            m_pSocket[i] = pSocket;
            return pSocket;
        }
Beispiel #5
0
CTCPClientSocket* CTCPManager::CreateClient ( void )
{
    for ( unsigned int i = 0; i < 255; i++ )
    {
        // Check for an empty socket pointer slot
        if ( m_pSocket[i] == NULL )
        {
            // Create the socket and initialize it
            CTCPClientSocketImpl* pSocket = new CTCPClientSocketImpl;
            CCore::GetSingleton().GetConsole()->Printf("Async socket #%u was created.\n", i);
            if ( !pSocket->Initialize ( i ) )
            {
                // Copy the error details, delete it and return NULL
                strcpy ( m_szLastError, pSocket->GetLastError () );
                SAFE_RELEASE ( pSocket )
                return NULL;
            }
            m_pSocket[i] = pSocket;
            return pSocket;
        }