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

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

CTCPSocket * Accept();

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

Accept a connection, create the socket class

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

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

    //First accept the socket
    SOCKET sok;

    //Where we are connected to
    sockaddr_in saConnected;

    //Size of the structure
    int iTmp;
    iTmp=sizeof(saConnected);

    //Accept it
    sok=accept(GetHandle(),(sockaddr*)&saConnected,&iTmp);

    if (sok!=INVALID_SOCKET)
    {
        //Create the new tcp socket
        CTCPSocket* tSok;
        tSok=new CTCPSocket(sok);

        //Set the address
        tSok->m_ConnectedTo=saConnected;

        return tSok;
    }
    else
    {
        //Error
        SetLastError("Accept");
        return NULL;
    }
}
ERROR_HANDLER_RETURN("Accept",NULL)

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