I have been working on a NSStreamDelegate
, I have implemented call back, I have initialized the input and output stream ilke this...
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStringRef host = CFSTR("74.125.224.72");
UInt32 port = 2270;
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, host, port, &inputStream, &writeStream);
if (writeStream && inputStream) {
inputStream = (__bridge NSInputStream *)readStream;
[inputStream setDelegate:self];
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[inputStream open];
outputStream = (__bridge NSOutputStream *)writeStream;
[outputStream setDelegate:self];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream open];
}
Even after opened both the stream callback(stream:(NSStream *)theStream handleEvent:)
is not called with NSStreamEventOpenCompleted
for both streams. Can anyone help me what am I doing wrong here. Or What is the possibilities NSStreamEventOpenCompleted
won't be called, I have seen in documentation, if opening failed it will not call this, if so why opening of streams is failing. Any idea?
thanks for your help.
[NSRunLoop mainRunLoop]
.