我正在尝试在我的 iPhone 应用程序中访问 61616,并且 SCReachability 代码表明我有一个有效的网络,但我尝试写入 61616 时超时。有谁知道:
A. 如果 iPhone EDGE/3G 网络的端口范围有限或不允许连接到此端口?
B. 我如何明确地检查对该端口的访问。这是我的“网络可达”代码(借用自 Apple 的示例),它检查“foo.bar.com”,但没有显示如何检查“foo.bar.com:61616”。
任何帮助表示赞赏!
- (BOOL)isDataSourceAvailable{
static BOOL checkNetwork = YES;
BOOL _isDataSourceAvailable = NO;
if (checkNetwork) { // Since checking the reachability of a host can be expensive, cache the result and perform the reachability check once.
checkNetwork = NO;
Boolean success;
const char *host_name = "foo.bar.com";
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, host_name);
SCNetworkReachabilityFlags flags;
success = SCNetworkReachabilityGetFlags(reachability, &flags);
_isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired);
CFRelease(reachability);
}
return _isDataSourceAvailable;
}