How can i put a timeout on a sub

  • Thread starter Thread starter =?iso-8859-1?B?UultaQ==?=
  • Start date Start date
?

=?iso-8859-1?B?UultaQ==?=

Hi,

I'm trying to scan some computer with WMI. All my call
are a procedure call SCAN(). Something, the procedure get
stock in a request call to a network computer (the
computer is always online and i have permissions to
scan). I'll like to know how to put a timeout value to my
sub so i can stop the process and begin a scan to another
computer.

Thanks
 
If you are scanning machines on the network, you are really going to want to
use multiple threads anyway since most of your time is spent waiting for a
response from the remote machine. You should create a class to contain the
data you are looking for and have a procedure in that class be the thread
entry point. Then start multiple threads to do the actual work. If you
really need a timeout (you may not when architected this way, unless ALL
threads get stuck the same way on different machines), then you can always
abort any thread that gets stuck for too long.

Jerry
 
* "Rémi said:
I'm trying to scan some computer with WMI. All my call
are a procedure call SCAN(). Something, the procedure get
stock in a request call to a network computer (the
computer is always online and i have permissions to
scan). I'll like to know how to put a timeout value to my
sub so i can stop the process and begin a scan to another
computer.

Maybe starting the work in a separate thread and aborting this thread is
a solution. Have a look for "multithreading" in the documentation for
info on how to do that.
 
Back
Top