Class CTCPPortScanner::
NewSocket()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: IsFinishedNext page: OnPort    Show member index
Protected Function Declared in:
TCPPortScanner.h

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

BOOL NewSocket();

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

Create a new socket

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

try
{
    //Are we done
    if (m_bDone ||
        m_bFinished)
        return TRUE;

    //Get a port
    unsigned short usPort;
    usPort=GetNextPort();

    //Do we have it
    if (!usPort)
    {
        //Are we done
        if (AdjustNumberOfSockets(-1)<=0)
            ScanDone(FALSE);

        //Exit
        return TRUE;
    }

    //Create the socket
    CTCPSocketAsync* pSocket;
    pSocket=AllocateSocket(usPort);

    //Create it
    if (!pSocket)
    {
        //Are we done
        if (AdjustNumberOfSockets(-1)<=0 &&
            !CanScan())
        {
            //Run the scan
            ScanDone(FALSE);

            //Exit
            return TRUE;
        }
        else
            return FALSE;
    }

    //Connect it
    if (!pSocket->Connect(0,
                          m_aTarget,
                          usPort))
    {
        //Dispose the socket
        DestroySocket(pSocket);

        //Are we done
        if (AdjustNumberOfSockets(-1)<=0 &&
            !CanScan())
        {
            //Run the scan
            ScanDone(FALSE);

            //Exit
            return TRUE;
        }
        else
            return FALSE;
    }

    //We scanned the port
    PortScanned(usPort);

    //Done
    return TRUE;
}
ERROR_HANDLER_RETURN("NewSocket",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.