I need to decide if timeout has occurred and save the entry into list array.
This is how I ping and add the round trip value to one list array:
static void Ping()
{
Console.Write(Environment.NewLine + "Start the test? (y/n): ");
if (Console.ReadLine().ToLower() == "y")
{
List<int> lag = new List<int>();
Console.WriteLine();
for (int server = 1; server <= 139; server++)
{
string url = "world" + server.ToString() + ".runescape.com";
Console.WriteLine("Checking world " + server + "...");
Ping ping = new Ping();
PingReply reply = ping.Send(url);
lag.Add(int.Parse(reply.RoundtripTime.ToString()));
}
// ... More Code Here ...
}
}
How to do this?
See the Status property
it returns an IPStatus which should have the according status.