0

Below is a part of my program. I have some IPs which I ping them but when I print out a success or not message for each one I would like to get a name except from IP. One way is if (192.168.100) then "example" but is there easier way to do this and more dynamically in order to be easier to add addresses?

public static string[] addresses = { "192.168.1.100", "192.168.1.254", "192.168.1.253" };

static void Main(string[] args)
{
    List<Task<PingReply>> pingTasks = new List<Task<PingReply>>();
    foreach (var address in addresses)
    {
        pingTasks.Add(PingAsync(address));
    }
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

0 Answers0