asynchronous methods or create my own threads?

D

djc

here is my task:
I am writing a command line utility that I can use to quickly reboot some
wireless access points (why? short answer: budget). That part is already
done. All it does is send the url that is essentially the command to reboot
to one or all of my access points. This works fine. What I want to add to
this is the ability for my program to let me know when the access points
have completed rebooting. In simple terms I just need to repeatedly ping the
access point until it responds which tells me its back up. If I were content
just doing one at a time then no problem. But I'm not.

Rather than send my reboot command to one access point and have to wait for
it to come back up before going on to the next access point I want to send
the command to all the access points (4 in my case) and use 4 new seperate
threads, 1 for each access point, to send the pings. I want my console to
show some indication that its working like printing dots and as each access
point comes back up (responds to the ping) indication should be sent to the
console.

as concisely as possible: command to reboot is sent, starts pinging, pings
first get replies for a few seconds until the access point actually goes
down, then no ping replies indicate its down, then when ping replies come
back again I know the access point is back up again and the reboot was
successfull.

Thats what I'm looking to do. I have done no mutlithreaded programming
before and know only of the general concepts of the asynch pattern and using
the thread classes to manage your own threads.

So what I am hoping to get out of this post is direction on which method
(asynch or threading) is best suited for my task. I will then start reading
up on that method. Any further info or suggestions on my specific task is of
course welcome as well.
 
G

Guest

djc,
If you know you are only going to have 4 access points then most likely just
creating 4 individual threads as background threads each to do the same work
with the same method is the easiest. Asynchronicity won't buy much for you
here since each thread (by your definition) won't be completely done until it
has successfully pinged the access point it rebooted as "back-up".

Peter
 
D

djc

thanks for the input. I'll focus on learning about the system.threading
namespace then.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top