4

我使用 CFStream Socket 向主机发送数据。第一次发送是工作。但首先,主机接收的数据总是被分散的。例如:

第一次发送:

Sender:  <11223344 55667788>
Recver:  <11223344 55667788> 

好的,很好

第二次,第三次……

Sender:  <11223344 55667788>
Recver:  <11>
Recver:  <223344 55667788> 

此症状仅在 IOS 7.0 中出现。6.0、5.0没有这个症状...

enter code here
CFReadStreamRef inputStream;
CFWriteStreamRef outputStream;
CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)_owner.ip, _owner.port, &inputStream, &outputStream);
NSDictionary *sslSettings = @{(id)kCFStreamSSLValidatesCertificateChain: (id)kCFBooleanFalse};
CFReadStreamSetProperty(inputStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelTLSv1);
CFReadStreamSetProperty(inputStream, kCFStreamPropertySSLSettings, (__bridge CFTypeRef)(sslSettings));
CFWriteStreamSetProperty(outputStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelTLSv1);
CFWriteStreamSetProperty(outputStream, kCFStreamPropertySSLSettings, (__bridge CFTypeRef)(sslSettings));
_inputStream = (__bridge_transfer NSInputStream *)inputStream;
[_inputStream setDelegate:self];
[_inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];

_outputStream = (__bridge_transfer NSOutputStream *)outputStream;
[_outputStream setDelegate:self];
[_outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];

[_inputStream open];
[_outputStream open];

谢谢

4

1 回答 1

0

这似乎是缓解 BEAST 攻击的 1/n-1 拆分技术。http://threatpost.com/apple-turns-on-safari-beast-attack-mitigation-by-default-in-os-x-mavericks/102804

您的服务器可能只支持 TLS 1.0。如果你升级你的服务器以支持 TLS 1.2,我相信 iOS 会停止这样做。

于 2014-05-07T19:23:09.643 回答