problem with NSInputStream on real iPhone
        Posted  
        
            by ThamThang
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ThamThang
        
        
        
        Published on 2010-01-21T10:49:50Z
        Indexed on 
            2010/04/16
            21:43 UTC
        
        
        Read the original article
        Hit count: 310
        
iphone
|cocoa-touch
Hi guys, 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 perfectly on simulator and real iPhone. If I try to read large data (more than 4kB or maybe 5kB), the real iPhone just can read 2736 bytes and stop.
Why is it? Help me plz! Merci d'avance!
© Stack Overflow or respective owner