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: Jay Koutavas <email@hidden>
- Date: Tue, 15 Feb 2005 06:47:11 -0500
Title: Re: Anyone got SSL over NSStreams to
work?
That's just my example text. In my real code I have host there. I
over simplified the code for the example.
Have you gotten SSL to work using NSStreams?
/Jay
At 2:18 AM -0800 on 2/15/05, Fred Baker wrote:
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
--
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Jay
Koutavas
mailto:email@hidden
Heynow
Software
http://www.heynow.com
Windham, New Hampshire, USA
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_______________________________________________
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