4
我是AsyncSocket的新手,我拼命想讓它連接到端口5222(xmpp)上的Facebook聊天服務器(chat.facebook.com),並且它做得非常好。它在Facebook切換到安全套接字之前正常工作。AsyncSocket TLS HOWTO
現在服務器告訴我start-tls,所以我調用[socket startTLS:nil],它什麼都不做。任何嘗試寫入套接字之後都不會導致任何結果。服務器將停止響應,我不知道我做錯了什麼。
-(void)startTLS:(id)_void
{
NSLog(@"********* StartTLS");
// Configure SSL/TLS settings
NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:4];
[settings setObject:host forKey:(NSString *)kCFStreamSSLPeerName];
// Allow expired certificates
[settings setObject:[NSNumber numberWithBool:YES]
forKey:(NSString *)kCFStreamSSLAllowsExpiredCertificates];
//
// Allow self-signed certificates
[settings setObject:[NSNumber numberWithBool:YES]
forKey:(NSString *)kCFStreamSSLAllowsAnyRoot];
//
// In fact, don't even validate the certificate chain
[settings setObject:[NSNumber numberWithBool:NO]
forKey:(NSString *)kCFStreamSSLValidatesCertificateChain];
[socket startTLS:settings];
}
任何具有AsyncSocket經驗的人都可以嘗試連接到服務器並告訴我我做錯了什麼?
感謝您的幫助