Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 09, 2012 08:32 PM by CodeHobo
Apr 09, 2012 07:03 PM|LINK
My application has a textbox which takes in a list of servers. I have a method that can take a server name, ping it, and return the results. Currently, I am doing everything in a for loop, pinging one server at a time. I would like to do this in parallel.
Here's what I would like to have: when the list of servers is submitted, display them on the page in a grip, and display a "processing" message next to every server. Fire off bunch of threads to ping every server, and when it's done, change the message to
whatever the status of the server is.
I am not sure where to start, so can someone steer me in the right direction? Are there any tutorials I can read on multithreading and ajax in MVC?
Apr 09, 2012 07:34 PM|LINK
I would like to do this in parallel.
USe task parallel library ( search for TPL C#) . Or read this best resource
Before a task starts, wrote a registration of what the server name is
Once a task have finished , wrote that you have ping the server and the result in the registration
From MVC , you can either ask the server at intervals( Ajax) or use an Http meta tag refresh to reload the action and see what servers have finished.
Apr 09, 2012 08:32 PM|LINK
In addition to Andrei, you can use Signal R https://github.com/SignalR/SignalR to send back notifications from the server to the the client when a process has finished.