I'm trying to create Bonjour client and in the process trying to setup input and output streams, I've successfully created the bonjour client, detected them and resolved them. After resolving I'm trying to setup input and output streams but when I tried sending message they do not go. The stream delegates are not getting called either, when I check the stream status it is always 1 (i.e opening), but never changes to open. Here is what I'm doing to get streams:
-(void)viewDidAppear:(BOOL)animated { [self.service getInputStream:&inputStream outputStream:&outputStream]; if(inputStream && outputStream) { [outputStream setDelegate:self]; [inputStream setDelegate:self]; [self scheduleInCurrentThread]; [inputStream open]; [outputStream open]; NSLog(@"%lu",(unsigned long)inputStream.streamStatus); NSLog(@"got Streams"); } else { NSLog(@"failed to acquire streams"); } }#pragma mark - schedule in current thread - (void)scheduleInCurrentThread {
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
P.S: No object is nill.