- (BOOL)isNetworkReachable{

struct sockaddr_in zeroAddr;

bzero(&zeroAddr, sizeof(zeroAddr));

zeroAddr.sin_len = sizeof(zeroAddr);

zeroAddr.sin_family = AF_INET;

SCNetworkReachabilityRef target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr*)&zeroAddr);

SCNetworkReachabilityFlags flag;

SCNetworkReachabilityGetFlags(target, &flag);

if(flag & kSCNetworkFlagsReachable){

return YES;

}else{

return NO;

}

}

'Tips & Tech > Objective-C' 카테고리의 다른 글

Xcode4 빌드 옵션 설정 방법  (0) 2012.02.27
Xcode4에서 프레임워크 추가  (0) 2012.02.27
문자열  (0) 2012.02.27
iPhone Device Network check(3G)  (0) 2012.02.27
xcode4 단축키  (0) 2012.02.27

+ Recent posts