are you sure the data is being sent? What's on the other end sending it, is it buffering data and not sending the last 216 bytes?

On Oct 24, 2008, at 2:37 AM, Thaddeus Cooper wrote:

Hi All.

I have an NSInputStream that I've set up on the run loop to read data from a socket. It's mostly working except that when I am sending it a large amount of data (say 30k), the last chunk of data never shows up. I have tried reading 1 byte, 10 bytes and 1024 bytes in the handleStream method and the last 216 bytes never show up.

I've looked in the archives and noticed that 3 years ago someone else had a similar problem -- but there was no followup.

The question I have is what do I need to do to get the last chunk of data off the stream. Below is a snippet of the code I'm using to read data off the stream inside handleEvent.

Thanks very much.

Thaddeus O. Cooper
([EMAIL PROTECTED])

while ([_inStream hasBytesAvailable]) {
        len = [(NSInputStream *)stream read:buf maxLength:1024];
        [data appendBytes:(const void *)buf length:len];
        bytesRead = bytesRead + len;                                    
}


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to