Note that there are some explanatory texts on larger screens.

plurals
  1. POCFStream + SSL results in OSStatus error -108
    primarykey
    data
    text
    <p>I have some code that creates a pair of <code>CFStream</code> objects to a remote server with <strong>SSL/TLS</strong> enabled. This code works just fine on OS X, but when run under iOS, it fails. Here's the console log:</p> <pre><code>2011-04-26 22:39:35.820 RemoteSample[92127:40b] connecting to 192.168.1.187:8099 2011-04-26 22:39:35.825 RemoteSample[92127:40b] INPUT: NSStreamEventOpenCompleted 2011-04-26 22:39:35.825 RemoteSample[92127:40b] OUTPUT: NSStreamEventOpenCompleted 2011-04-26 22:39:35.827 RemoteSample[92127:40b] INPUT: NSStreamEventErrorOccurred 2011-04-26 22:39:35.828 RemoteSample[92127:40b] Error on input stream: The operation couldn’t be completed. (OSStatus error -108.) 2011-04-26 22:39:35.829 RemoteSample[92127:40b] OUTPUT: NSStreamEventErrorOccurred 2011-04-26 22:39:35.829 RemoteSample[92127:40b] Error on output stream: The operation couldn’t be completed. (OSStatus error -108.) </code></pre> <p>OSStatus error -108 appears to be memFullErr, which is simply bizarre and I'm not quite sure what to do about it. This occurs both in the simulator and on device. It compiles and runs without this issue in a Mac OS X application. Only when built for iOS does this error occur.</p> <p>Having spent several hours trying various ideas and lots of searching, I could use some advice about next steps.</p> <p>Here is the code:</p> <pre><code>CFReadStreamRef inCfStream = NULL; CFWriteStreamRef outCfStream = NULL; CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)host, port, &amp;inCfStream, &amp;outCfStream); if (inCfStream &amp;&amp; outCfStream) { CFReadStreamSetProperty(inCfStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); inStream = NSMakeCollectable(inCfStream); outStream = NSMakeCollectable(outCfStream); [inStream setDelegate:self]; [outStream setDelegate:self]; [inStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey]; NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates, [NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot, [NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain, kCFNull,kCFStreamSSLPeerName, nil]; if (CFReadStreamSetProperty(inCfStream, kCFStreamPropertySSLSettings, (CFTypeRef)properties) == FALSE) { NSLog(@"Failed to set SSL properties on read stream."); } inputBuffer = [[NSMutableData alloc] init]; [inStream open]; [outStream open]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload