I have a problem with NSInputStream. Here is my code:
case NSStreamEventHasBytesAvailable: printf("BYTE AVAILABLE\n"); int len = 0; NSMutableData *data = [[NSMutableData alloc] init]; uint8_t buffer[32768]; if(stream == iStream) { printf("Receiving...\n"); len = [iStream read:buffer maxLength:32768]; [data appendBytes:buffer length:len]; } [iStream close];
I try to read small data, and it works great on a simulator and a real iPhone. If I try to read big data (more than 4 KB or maybe 5 KB), a real iPhone can just read 2736 bytes and stop.
Why? Help me plz! Merci d'avance!
source share