Class CTCPSocket::
Accept()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: m_uiSequenceNext page: Accept    Show member index
Public Function Declared in:
TCPSocket.h

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

BOOL Accept(
    CTCPSocket* pNewSocket);

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

Accept a connection, supply an already made socket

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

try
{
    //Quit if not ok
    if (!CheckSocketValid())
        return FALSE;

    //First accept the socket
    SOCKET aNewSocket;

    //Where we are connected to
    sockaddr_in aAddress;

    //Size of the structure
    int iSize;
    iSize=sizeof(aAddress);

    //Accept it
    aNewSocket=accept(GetHandle(),
                      (sockaddr*)&aAddress,
                      &iSize);

    //Is it OK
    if (aNewSocket!=INVALID_SOCKET)
    {
        //Call before accept routing
        pNewSocket->BeforeAccept();

        //Set the socket data
        pNewSocket->SetConnectedTo(aAddress);
        pNewSocket->AssignSocket(aNewSocket);
        pNewSocket->SetConnectionStatus(TRUE);
        pNewSocket->Accepted();

        //Exit
        return TRUE;
    }
    else
    {
        //Error
        SetLastError("Accept");

        //Exit
        return FALSE;
    }
}
ERROR_HANDLER_RETURN("Accept",FALSE)

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

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