![]() |
Scan() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: TCPPortScannerMultithreaded.h |
virtual BOOL Scan( IP aTarget);
//Check max sockets are ok if (GetMaxSockets()<=0 || !IsDone() || !aTarget || (m_iMaxThreads<=0 && !m_pThreadPool)) { //Report it ReportError("Scan","Invalid parameters!"); //Exit return FALSE; } try { //Reset the pair ResetPair(); //Can we scan if (!CanScan()) { //Error ReportError("Scan","No ports given!"); //Error SetError(TRUE); //Exit return FALSE; } //Set the flags SetError(FALSE); SetDone(FALSE); //Save the number of max sockets ResetSocketCount(); //Delete the port data DeletePortsMap(); //Delete other data ResetData(); //Set our target SetTarget(aTarget); //Do we need to modify the thread pool if (m_bOwners && m_pThreadPool && m_iMaxThreads>0 && m_pThreadPool->GetMaxThreads()!=m_iMaxThreads) { //Delete it for recreation delete m_pThreadPool; m_pThreadPool=NULL; } //Thread pool, do we have it if (!m_pThreadPool) { //Create it m_pThreadPool=new CThreadPool(m_iMaxThreads); //We are the owners m_bOwners=TRUE; } //Start the loop for (int iCounter=0; iCounter<GetMaxSockets(); ++iCounter) //Spawn a thread m_pThreadPool->SubmitJob(SocketProc, (LPVOID)this); //Done return TRUE; } ERROR_HANDLER_RETURN("Scan",FALSE)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |