curl-library
Re: Seeking functionality during download
Date: Thu, 07 May 2009 10:52:13 +0000
From: neha bhagat <nehabhagat.4_at_gmail.com>
Date: Thu, 7 May 2009 15:58:26 +0530
On 5/7/09, centrio_at_gmail.com <centrio_at_gmail.com> wrote:
> Hi,
> I want to know if curl has any seeking functionality to seek into a stream
> which is getting downloaded. I found function CURLOPT_SEEKFUNCTION but it
> can be used for uploading only. However for downloading there are some
> options available like CURLOPT_RANGE CURLOPT_RESUME_FROM and
> CURLOPT_RESUME_FROM_LARGE . How can I achienve the seeking functionality
> using this. I want to seek depending upon the offset and the position from
> where the offset begins. Like we have SEEK_SET, SEEK_CUR and SEEK_END in
> seek function, i need similar functionality for download. Please help. Is
> there any direct way to achieve this using libcurl or do i have to create
> my
> own logic to set proper offset for download depending upon position.?
> Hi,
> U can use range option........
> .eg
> if you want to seek from offset 5 to 10 ,use
> char * range;
> strcpy( range ,"5-10")
> and then set option using CURLOPT_RANGE
> it works for downloads....I have got the results......
I am aware of this functionality. But i want to give the offset and the
position in stream from where this offset is. For example4 bytes from
beginning of stream, or 4 bytes from current position in the stream or 4
bytes from the end of the stream. I think the range takes absolute values
in stream. And also the other options like RESUME_FROM also take number of
bytes starting from the beginning of the stream. I want some thing that
would work giving the offset and the relative position of offset.
> Infact I want to upload the file in the same way ......but range option
> doesnot work......
> If you have got the results please revert......
I guess for uploading similar functionality can be achieved using
CURLOPT_SEEKFUNCTION . Set a callback with this. Never tried it but.
Thanks
Shivanand
Received on 2009-05-07