I'm trying to test a server connection with the GCDAsyncSocket.
https://github.com/robbiehanson/CocoaAsyncSocket
I want to connect to a ip + port and get a message, whether it worked, or not.
I'm so far right now.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ // Override point for customization after application launch.
dispatch_queue_t mainQueue = dispatch_get_main_queue();
asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];
NSString *host = @"www.google.de";
uint16_t port = 21;
NSError *error = nil;
if(![asyncSocket connectToHost:host onPort:port error:&error])
{
NSLog(@"ERROR %@!!!", error);
}
else{
NSLog(@"NO ERROR %@!!!", error);
}
[asyncSocket writeData:@"DATA" withTimeout:3 tag:0];
return YES;
}
But how can i check whether the Data was written or not?
if(![asyncSocket connectToHost:host onPort:port error:&error])
always get me a no error.