Hi,
I'm a newbie in iOS network programming, so please forgive my ignorance.
I'm in a situation where a client opens an initial socket communication to the server. A brief exchange of un-encoded messages is sent, which directs both sides to use a new protocol which utilizes SSL to encode the rest of the sessions messages. Is it legitimate to transition from TCP_CLEAR to SSL_ANON once the connection is made?
As an experiment, I've tried the following code to try to get the SSL context, & then hopefully transition to SSL later. The problem is that the calls to get the properties kCFStreamPropertySSLContext or CFReadStreamGetStatus come back with invalid (nil) pointers:
-(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
if(isPrimaryConnection)
{
int readLength = sizeof(APCP_MSG_HDR);
[socket readDataToLength:readLength withTimeout:SOCKET_TIMEOUT tag:READ_APCP_HEADER];
\\ SNIP
CFReadStreamRef stream = [sock getCFReadStream];
CFDataRef data = "" style='color:#5C2699'>CFDataRef) CFReadStreamCopyProperty(stream, kCFStreamPropertySSLContext);
CFDataRef data2 = (CFDataRef) CFReadStreamGetStatus(stream);
. . .
Is there a way to do this? Any suggestions or alternatives would be appreciated.
Thanks
George Griffin