Fwd: NSData downloaded over socket is bigger than it should be...
Fwd: NSData downloaded over socket is bigger than it should be...
- Subject: Fwd: NSData downloaded over socket is bigger than it should be...
- From: email@hidden
- Date: Fri, 19 Dec 2008 09:55:16 +0000
I think that this there is still not enough example code here to help.
I use AsyncSocket extensively and any trouble I have had with data
transfer has been my fault entirely.
-(void)onSocket:(AsyncSocket *)sock didReadData:(NSData*)data
withTag:(long)tag
Having said that I always use the AsyncSocket method
- (void)readDataToLength:(CFIndex)length withTimeout:
(NSTimeInterval)timeout tag:(long)tag;
Maybe not possible in your case if you don't know the transfer size to
begin with.
Maybe try constructing some test data of a known size that causes
failure.
Then swap your call to
(void)onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:
(long)tag
for a single call to
- (void)readDataToLength:(CFIndex)length withTimeout:
(NSTimeInterval)timeout tag:(long)tag;
using your known data length.
Should help to sort out were the data is getting mishandled.
It's a bit hard to track because the setup,as I said, works with
multiple simultaneous connections etc, but it's really straight
forward: ONE socket downloads ONE segment and save it to disk... the
decoder deals with putting all the segments together once all the
segments of a file have been downloaded... but most segments have
extra bytes in them...
Does the problem only arise when multiple connections are active, or
can it be triggered in a single isolated transfer?
And to make it workse, sometimes (usually when I grab stuff like
images or smaller stuff like that which consist of only 1 segment)
then they end up just fine... the extra bytes are only present with
bigger attachment (of 1mb+) and especially with multiparts
attachments...
This is not worse, its better. Implies that the problem may arise from
conjoining the segments.
Jonathan Mitchell
Central Conscious Unit
http://www.mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden