You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 rivejä
623 B

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net.NetworkInformation;
  5. using System.Net;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace HKLog
  9. {
  10. public class PingHelper
  11. {
  12. public static bool PingTest()
  13. {
  14. try
  15. {
  16. var ping = new Ping();
  17. PingReply replyPing = ping.Send("www.baidu.com");
  18. ping.Dispose();
  19. return replyPing.Status == IPStatus.Success;
  20. }
  21. catch
  22. {
  23. return false;
  24. }
  25. }
  26. }
  27. }