1

I have NSInputStream , i want to check if i am getting data from other end , i read the NSStreamStatus , i cam across that "NSStreamStatusReading" is use to check the read data .

I tried to check that status but its not working can any one tell me how to check if i am getting data or not .. code:

if([inputStream streamStatus]==NSStreamStatusReading)
{
NSlog(@"server is sending");
}
else
{
NSlog(@"no");

}

its working when its sending but when i stop server , its not updating .

Diaaaaan
  • 35
  • 6
  • is this code inside the stream: handleEvent: delegate method? – meth Apr 16 '13 at 13:54
  • yes this is under handleevent – Diaaaaan Apr 16 '13 at 13:57
  • switch(event) { case (NSStreamStatus)NSStreamEventErrorOccurred: { NSLog(@"%@",[stream streamError].localizedDescription); } break; you can check errors with this code – meth Apr 16 '13 at 13:59
  • I am using switch(streamEvent){case NSStreamEventOpenCompleted:NSLog(@"stream Opened"); break; i want to check if i am getting any data or not ... – Diaaaaan Apr 16 '13 at 14:03
  • you can add case NSStreamEventHasBytesAvailable: to list. and print the length of data if data occurs – meth Apr 16 '13 at 14:09

0 Answers0