private static async Task PingAsync(string address, ListView Devices, bool removeDupes) { Ping ping = new Ping(); var reply = await ping.SendPingAsync(address); if (reply.Status == IPStatus.Success) { string[] rows = { address, "Resolving", MAC_Helper.GetMacAddress(address) }; var listViewItem = new ListViewItem(rows); AddHost(Devices, listViewItem, removeDupes); } }
private async Task PingAsync(string address) { Ping ping = new Ping(); var reply = await ping.SendPingAsync(address); if (reply.Status == IPStatus.Success) { //get host name //IPAddress ip = Dns.GetHostEntry(address).AddressList.Where(o => o.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First(); string[] rows = { address, "", MAC_Helper.GetMacAddress(address) }; var listViewItem = new ListViewItem(rows); Devices.Items.Add(listViewItem); } }