I had my socket connection working, but the server was updated to SSL. I call this method:
[socket startTLS:nil];
Bu I still can’t make a secure connection with the server. I initiate the connection like this:
- (void) initNetworkCommunication {
dispatch_queue_t mainQueue = dispatch_get_main_queue();
socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];
NSError *err = nil;
if (![socket connectToHost:@"192.168.2.210" onPort:1333 viaInterface:@"" withTimeout:-1 error:&err]) // Asynchronous!
{
// If there was an error, it's likely something like "already connected" or "no delegate set"
NSLog(@"I goofed: %@", err);
}else
{
NSLog(@"Connecting...");
}
[socket readDataWithTimeout:-1 tag:1];
}
Can you help me with that?
I was calling the [socket startTLS:nil] after make the initNetworkCommunication, but it should be at the moment that we make the connection, like this: