project_files/HedgewarsMobile/Classes/ServerSetup.m
changeset 5483 fc755bb8096d
parent 5206 db775bddf771
child 6078 8c0cc07731e5
--- a/project_files/HedgewarsMobile/Classes/ServerSetup.m	Sat Jul 30 17:23:47 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/ServerSetup.m	Sun Jul 31 16:03:24 2011 +0200
@@ -22,8 +22,6 @@
 #import "ServerSetup.h"
 #import "PascalImports.h"
 #import "CommodityFunctions.h"
-#import <SystemConfiguration/SCNetworkReachability.h>
-#import <netinet/in.h>
 #import "hwconsts.h"
 
 #define BUFFER_SIZE 256
@@ -43,39 +41,6 @@
     [super dealloc];
 }
 
-// reusing appirater method
--(BOOL) isNetworkReachable {
-    // Create zero addy
-    struct sockaddr_in zeroAddress;
-    bzero(&zeroAddress, sizeof(zeroAddress));
-    zeroAddress.sin_len = sizeof(zeroAddress);
-    zeroAddress.sin_family = AF_INET;
-    
-    // Recover reachability flags
-    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
-    SCNetworkReachabilityFlags flags;
-    
-    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
-    CFRelease(defaultRouteReachability);
-    
-    if (!didRetrieveFlags) {
-        NSLog(@"Error. Could not recover network reachability flags");
-        return NO;
-    }
-    
-    BOOL isReachable = flags & kSCNetworkFlagsReachable;
-    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
-    BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
-    
-    NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
-    NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL
-                                                 cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
-                                             timeoutInterval:20.0];
-    NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
-    
-    return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
-}
-
 -(int) sendToServer:(NSString *)command {
     NSString *message = [[NSString alloc] initWithFormat:@"%@\n\n",command];
     int result = SDLNet_TCP_Send(sd, [message UTF8String], [message length]);