viperlogic wrote:
i am scanning alot of hosts with this app, waiting 2mins for every host would take for ever to scan the network, hence i use the thread timeout of 3secs
I did something very similar to this in a ping-type application. For each machine that I was going to ping, I just created a secondary thread and put the ping-related code in it. Given that the machines each responded in their own time, the threads all completed at different times; some were instantaneous while others took a lot longer. If your UI has some sort of listbox or list control for these machines, give them a default status of "Establishing connection. Please wait...". When that machine's thread terminates, replace the default status with what actually happened.
viperlogic wrote:
i just read about _endthread and it appears to work so far. is this a proper solution?
Not unless you also used _beginthread(). Regardless, it is called from within the secondary thread. Terminating a thread from within itself is vastly different than terminating a thread from some other thread.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb