I haven't really played with asyn operations before or multiple threads so this is all new to me. So I was hoping for some guidance
Suppose I have a class something like below
public class pinger
{
// Constructor
public Pinger()
{
do while exit = False;
Uri url = new Uri("www.abhisheksur.com");
string pingurl = string.Format("{0}", url.Host);
string host = pingurl;
bool result = false;
Ping p = new Ping();
try
{
PingReply reply = p.Send(host, 3000);
if (reply.Status == IPStatus.Success)
result = true;
}
catch { }
//wait 2 seconds
loop;
}
}
so I can call this with
Pinger firstone = new Pinger
What I want if for control to then return to the main thread leaving the created instance running and pinging the host every two seconds and updating the result variable, that I can then use a get property when I want to know the status from the main thread.
Can any one suggest some good reading / examples to introduce me to multi threading in c#, using Ping as an example seemed a good easy thing to try this out with :)
Cheers
Aaron
