Re: Anyone got SSL over NSStreams to work?
Re: Anyone got SSL over NSStreams to work?
- Subject: Re: Anyone got SSL over NSStreams to work?
- From: Fred Baker <email@hidden>
- Date: Tue, 15 Feb 2005 02:18:47 -0800
On Jan 13, 2005, at 7:45 PM, Jay Koutavas wrote:
Hi. I'm doing the following in an attempt to establish an SSL connection over NSStreams, per the NSStream documentation:
{ ...
[NSStream getStreamsToHost:@"blah.blah.com"
port:1234
inputStream:&mInStream
outputStream:&mOutStream];
[mInStream retain];
[mOutStream retain];
[mInStream setDelegate:self];
[mOutStream setDelegate:self];
[mInStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[mOutStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
assert([mInStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey]);
assert([mOutStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey]);
[mInStream open];
[mOutStream open];
}
In my stream:handleEvent: delegate method, I always get back an NSStreamEventErrorOccurred event with an NSUnknownErrorDomain (-9812) error. It doesn't matter which SSL property I set the socket to. Always the same error. Turning off SSL on the output stream doesn't change things either. On the server side, the machine's log is indicating that an SSL connection is being made. I'm running this on Mac OS X 10.3.7
Has anyone gotten this stuff to work? A search of the Net shows very few mentions of using SSL with NSStreams, and there are unanswered NSStreams+SSL questions in the cocoa-dev archive. I sure hope someone could shed so light on what I may be missing.
You're passing a NSString instead of the required NSHost to getStreamsToHost:port:inputStream:outputStream: .
Go to http://developer.apple.com/documentation/Cocoa/Conceptual/Streams/index.html, see "Setting Up Socket Streams," and take a look at Listing 1 there. It will show you exactly what to do.
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden