Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task Ping(int lowLim, int uppLim)
- {
- string[] ipParts = GetCurrentIPAddress().Split('.');
- for (int i = lowLim; i <= uppLim; i++)
- {
- IterEvent.Invoke(i);
- PingReply answer = await AsincPing(string.Format("{0}.{1}.{2}.{3}", ipParts[0], ipParts[1], ipParts[2], i.ToString()));
- string macAddress = await GetMACAddress(answer.Address);
- try
- {
- if (answer.Status == IPStatus.Success)
- {
- PingEvent.Invoke(answer.Address.ToString() + "|" + macAddress + "|" + answer.RoundtripTime +
- "|" + Dns.GetHostEntry(answer.Address.ToString()).HostName);
- }
- }
- catch
- {
- PingEvent.Invoke(answer.Address.ToString() + "|" + macAddress + "|" + answer.RoundtripTime + "|" + ".....");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement