Re: Audio file download over HTTP issue!
Re: Audio file download over HTTP issue!
- Subject: Re: Audio file download over HTTP issue!
- From: "Andy Cave" <email@hidden>
- Date: Mon, 22 Oct 2007 15:43:10 +0100
- Organization: Hamillroad Software
But that's something I suggest you check out (I've not used
CFReadStreamRead), as things can change when you're using sync vs async
APIs'. Depending on the API definition, a return value of 0 can mean EOF or
could mean 'no-bytes' to read at this moment in time. Most API's return -1
to mean an error of sorts, which can mean a real-erorr or a no-bytes error.
I suggest you read the documentation on CFReadStreamRead as to the return
codes et al.
Checking apples web site:
CFReadStreamRead
...
Return Value
The number of bytes read; 0 if the stream has reached its end; or -1 if
either the stream is not open or an error occurs.
Discussion
If stream is in the process of opening, this function waits until it has
completed. This function blocks until at least one byte is available; it
does not block until buffer is filled. To avoid blocking, call this function
only if CFReadStreamHasBytesAvailable returns TRUE or after the stream's
client (set with CFReadStreamSetClient) is notified of a
kCFStreamEventHasBytesAvailable event.
Which says it all. QED.
Regards,
Andy.
----- Original Message -----
From: "Frederick Cheung" <email@hidden>
To: "Ulhas Morbale" <email@hidden>
Cc: "Andy Cave" <email@hidden>; <email@hidden>
Sent: Monday, October 22, 2007 2:07 PM
Subject: Re: Audio file download over HTTP issue!
On 22 Oct 2007, at 14:03, Ulhas Morbale wrote:
then how will I came to know that all the data is read from the server.
Is there any function to find out the size of the file on the server, so
that I terminate the do-while loop.
You wait until CFReadStreamRead returns 0 .
Fred
Thanks,
Ulhas Morbale
----- Original Message -----
From: "Andy Cave" <email@hidden>
To: "Ulhas Morbale" <email@hidden>; "Frederick
Cheung"
<email@hidden>
Cc: <email@hidden>
Sent: Monday, October 22, 2007 6:26 PM
Subject: Re: Audio file download over HTTP issue!
Yes - because when you run debug code, or are in the debugger, lots of
data
comes across the network and gets cached by the OS. So you always read
large
amounts.
The previous poster was likely 99.999...% spot on. Don't assume you'll
always get the amount your buffer size is that you request. Then your
code
will work (if you change it thus).
Andy.
----- Original Message -----
From: "Ulhas Morbale" <email@hidden>
To: "Frederick Cheung" <email@hidden>
Cc: <email@hidden>
Sent: Monday, October 22, 2007 1:53 PM
Subject: Re: Audio file download over HTTP issue!
But I am getting whole data when I debug my code.
Any more clue(s).
Thanks,
Ulhas Morbale
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40hamillroad.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden