-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from EddyLB/master
Improved connection management
- Loading branch information
Showing
12 changed files
with
434 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright (C) 2016 Apple Inc. All Rights Reserved. | ||
See LICENSE.txt for this sample’s licensing information | ||
Abstract: | ||
Basic demonstration of how to use the SystemConfiguration Reachablity APIs. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <SystemConfiguration/SystemConfiguration.h> | ||
#import <netinet/in.h> | ||
|
||
|
||
typedef enum : NSInteger { | ||
NotReachable = 0, | ||
ReachableViaWiFi, | ||
ReachableViaWWAN | ||
} NetworkStatus; | ||
|
||
#pragma mark IPv6 Support | ||
//Reachability fully support IPv6. For full details, see ReadMe.md. | ||
|
||
|
||
extern NSString *kReachabilityChangedNotification; | ||
|
||
|
||
@interface Reachability : NSObject | ||
|
||
/*! | ||
* Use to check the reachability of a given host name. | ||
*/ | ||
+ (instancetype)reachabilityWithHostName:(NSString *)hostName; | ||
|
||
/*! | ||
* Use to check the reachability of a given IP address. | ||
*/ | ||
+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress; | ||
|
||
/*! | ||
* Checks whether the default route is available. Should be used by applications that do not connect to a particular host. | ||
*/ | ||
+ (instancetype)reachabilityForInternetConnection; | ||
|
||
|
||
#pragma mark reachabilityForLocalWiFi | ||
//reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information. | ||
//+ (instancetype)reachabilityForLocalWiFi; | ||
|
||
/*! | ||
* Start listening for reachability notifications on the current run loop. | ||
*/ | ||
- (BOOL)startNotifier; | ||
- (void)stopNotifier; | ||
|
||
- (NetworkStatus)currentReachabilityStatus; | ||
|
||
/*! | ||
* WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand. | ||
*/ | ||
- (BOOL)connectionRequired; | ||
|
||
@end | ||
|
||
|
Oops, something went wrong.