request assistance resolving a std.net.curl segmentation fault

anonymouse anony at mouse.com
Fri May 19 23:36:28 UTC 2023


On Friday, 19 May 2023 at 12:40:29 UTC, Danny Arends wrote:
> On Friday, 19 May 2023 at 11:07:01 UTC, anonymouse wrote:
>> What am I doing wrong here?
>>
[SNIP]
>
> You're running the whole thing in a while(TRUE) loop,
> recreating the curl object re-initiating the transfer and file 
> pointer, etc.

The reason I used a while loop was to detect loss of internet 
connection and resume the process once the connection is 
re-established. What would have been a better approach?

> furthermore, the              curl.set(CurlOption.writedata, 
> &fp); doesn't work as you expect..

The idea was to detect an incomplete download and continue from 
where it left off. I'm sometimes downloading files 15Gb or 
greater. Reaching 80% and having to restart the process is a 
nogo. As I understand it, `CurlOption.writedata` allows me to 
achieve that goal. Is there a better option to accomplish the 
same?

> After fiddling a bit, this works:
>
>     curl.onReceive = (ubyte[] data) { fp.rawWrite(data); return 
> data.length;};
>

Thank you for your assistance thus far.

--anonymouse


More information about the Digitalmars-d-learn mailing list