PingTool.cs 508 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net.NetworkInformation;
  5. using System.Text;
  6. namespace Azylee.Core.NetUtils
  7. {
  8. public class PingTool
  9. {
  10. public static bool Ping(string ip)
  11. {
  12. try
  13. {
  14. Ping _ping = new Ping();
  15. PingReply _reply = _ping.Send(ip);
  16. return _reply.Status == IPStatus.Success ? true : false;
  17. }
  18. catch { return false; }
  19. }
  20. }
  21. }