Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFReadStream Completion Bug on <= 10.3.9



Hi all, I am having a problem in 10.3.9 where if CFReadStreamHasBytesAvailable() returns true, I call CFReadStreamRead () to get the bytes. Unfortunately, at the end of a download, about 5-10% of the time, CFReadStreamHasBytesAvailable() returns false because there are no more bytes to read (which is correct), but the stream never goes to kCFStreamStatusAtEnd or kCFStreamStatusClosed state. I tried saying CFReadStreamRead( stream, nil, 0 ) if no bytes were available, to try to tickle it, but it blocks forever in CFReadStreamRead(), waiting for more bytes to arrive (also a bug since I passed 0, but not really my concern right now). At this point I can't think of a way around this bug. I think other apps don't see it, because they tend to use a runloop instead of polling, and I imagine the finish event shows up there. I really don't want to wedge in a runloop at this point, since I am finished. I basically wrote my own class which uses URLAccess or CF streams depending on the OS version, which is why I didn't need events.

FYI I am using SSL and apache 2 on the server. For all I know, maybe it isn't orderly disconnecting on its end. But since I don't see this bug in 10.4, I think it's an Apple bug.

I can probably work around this by having a 5-10 second timeout and trying again. In certain places in my app, I can do a reload easily, but in others, it would sure be nice to know when a download completes.

Any ideas?  Thanx,

------------------------------------------------------------------------
Zack Morris              Z Sculpt Entertainment               This Space
email@hidden      http://www.zsculpt.com                 For Rent
------------------------------------------------------------------------
If the doors of perception were cleansed, everything would appear to man
  as it is, infinite. -William Blake, The Marriage of Heaven and Hell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden
References: 
 >RE: CFReadStream (From: "Patrick Lee" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.