APag96
asked on
Span Multiple Threads to Ping List of IPs
Have you ever seen those IP scanner programs where it goes through a range of IP addresses and pings each on on a separate thread and then returns the result?
I am making my OWN version of that. I have got everything done so far except that the pinging is VERY slow. In the commercial version of these programs, you can ask it to use 50 threads (just an example number) for pinging an IP on each. Of course, using 50 threads compared to 1 is MUCH faster.
But how do I spawn 50 different threads and ping a different IP address on each. I would also like the user to be able to input how many threads he wants the program to use.
I am using the Visual Studio code snippet ping code (My.Computer.Network.Ping( ip)) to ping the IPs.
THIS DOES NOT WORK: (Just letting you know.)
"for i = 1 to 50
dim s as new system.threading.thread(Ad dressOf pinger)
next"
Thank you.
I am making my OWN version of that. I have got everything done so far except that the pinging is VERY slow. In the commercial version of these programs, you can ask it to use 50 threads (just an example number) for pinging an IP on each. Of course, using 50 threads compared to 1 is MUCH faster.
But how do I spawn 50 different threads and ping a different IP address on each. I would also like the user to be able to input how many threads he wants the program to use.
I am using the Visual Studio code snippet ping code (My.Computer.Network.Ping(
THIS DOES NOT WORK: (Just letting you know.)
"for i = 1 to 50
dim s as new system.threading.thread(Ad
next"
Thank you.
ASKER
I'm very sorry, I do not completely understand your code. VS found many error. I am unable to correct all of them. Do you have more "complete" code?
Thanks
Thanks
ASKER
I understand your code now. But I need to be able to specify how many threads will be used to ping an IP.
you can use a counter and increment it in the loop and decrement it in the event handler
ASKER
Event handlers are new to me. Could you please provide an example?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window