• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSData downloaded over socket is bigger than it should be...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData downloaded over socket is bigger than it should be...


  • Subject: Re: NSData downloaded over socket is bigger than it should be...
  • From: Jean-Nicolas Jolivet <email@hidden>
  • Date: Fri, 19 Dec 2008 11:43:22 -0500

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@hidden 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@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

Jean-Nicolas Jolivet email@hidden http://www.silverscripting.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


  • Follow-Ups:
    • Re: NSData downloaded over socket is bigger than it should be...
      • From: "Michael Ash" <email@hidden>
References: 
 >Fwd: NSData downloaded over socket is bigger than it should be... (From: email@hidden)

  • Prev by Date: Re: Optimizing NSRectFill
  • Next by Date: Listening for changes
  • Previous by thread: Fwd: NSData downloaded over socket is bigger than it should be...
  • Next by thread: Re: NSData downloaded over socket is bigger than it should be...
  • Index(es):
    • Date
    • Thread