gpt4 book ai didi

ios - IOS 7.0 中 CFStream Socket 发送数据包不完整

转载 作者:可可西里 更新时间:2023-11-01 06:15:37 26 4
gpt4 key购买 nike

我使用 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];

谢谢

最佳答案

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

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

关于ios - IOS 7.0 中 CFStream Socket 发送数据包不完整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19002175/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com