PingHelper.h 780 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // PingHelper.h
  3. // RealReachability
  4. //
  5. // Created by Dustturtle on 16/1/19.
  6. // Copyright © 2016 Dustturtle. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @interface PingHelper : NSObject
  10. /// You MUST have already set the host before your ping action.
  11. /// Think about that: if you never set this, we don't know where to ping.
  12. @property (nonatomic, copy) NSString *host;
  13. /// Used as a backup for double checking.
  14. @property (nonatomic, copy) NSString *hostForCheck;
  15. /// Ping timeout. Default is 2 seconds
  16. @property (nonatomic, assign) NSTimeInterval timeout;
  17. /**
  18. * trigger a ping action with a completion block
  19. *
  20. * @param completion : Async completion block
  21. */
  22. - (void)pingWithBlock:(void (^)(BOOL isSuccess, NSTimeInterval latency))completion;
  23. @end