Well after doing more tests...

It happens even if I only have 1 active connection.... and it also happens even if only download 1 part of the multiparts file (i.e. the part is still slightly bigger than it should be) so basically the files that were ending up ok with multiple connections are still fine, the files that were ending up bigger than they should... are still bigger....

What I *don't* understand is how the data can be bigger .... I would understand if some bytes were lost... but added?? I just don't see why it's happening... I'm tempted to re-write my ConnectionController with NetSocket to see if I get the same result...



On 19-Dec-08, at 4:55 AM, [email protected] wrote:


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 protected])

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/silvertab%40videotron.ca

This email sent to [email protected]

Jean-Nicolas Jolivet
[email protected]
http://www.silverscripting.com

_______________________________________________

Cocoa-dev mailing list ([email protected])

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