Hello There,
I am facing the problem regarding
download(pure download no streaming!!!) a audio file over HTTP protocol.When I
debug my following code it downloads all data(~3MB) to my local system &
writes to the file and if I run without debug it returns only 4KB data. why it
is so?
void Write_Local(CFReadStreamRef readStreamRef,
CFWriteStreamRef writeStreamRef)
{
CFReadStreamOpen(readStreamRef);
CFWriteStreamOpen(writeStreamRef);
UInt8 buf[2048];
CFIndex totalBytesRead=0,
bytesRead=0;
CFIndex
totalBytesWritten=0;
do{
bytesRead = CFReadStreamRead(readStreamRef, buf, bufLength);
if(!bytesRead)
printf("ERROR!");
totalBytesRead+=bytesRead;
if(writeStreamRef)
totalBytesWritten +=
CFWriteStreamWrite(writeStreamRef, buf,
bytesRead);
}while(bytesRead == bufLength)
CFWriteStreamClose(writeStreamRef);
CFReadStreamClose(readStreamRef);
}
I am not getting any error, but can't able to
download large data. What is the problem with this code? Is that the buf size or
anything else? Help is greatly appreciated. Thanks in advance.
Many Thanks, Ulhas
Morbale
|