Kiriox
Kiriox
Explore posts from servers
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
No description
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Could this be impacted by the fact that my program downloads lots of files at the same time?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Yes, thank you, but I have the impression that the download is even slower
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
I try this, but it don't work
c#
int totalBytesRead = 0;
while (true)
{
int bytesRead = await source.ReadAsync(buffer.AsMemory(totalBytesRead, DefaultCopyBufferSize - totalBytesRead));
if (bytesRead == 0)
break;

totalBytesRead += bytesRead;
if (totalBytesRead >= DefaultCopyBufferSize || bytesRead == 0)
{
await destination.WriteAsync(buffer.AsMemory(0, totalBytesRead));
progress.Increment(totalBytesRead);
totalBytesRead = 0;
}
}
c#
int totalBytesRead = 0;
while (true)
{
int bytesRead = await source.ReadAsync(buffer.AsMemory(totalBytesRead, DefaultCopyBufferSize - totalBytesRead));
if (bytesRead == 0)
break;

totalBytesRead += bytesRead;
if (totalBytesRead >= DefaultCopyBufferSize || bytesRead == 0)
{
await destination.WriteAsync(buffer.AsMemory(0, totalBytesRead));
progress.Increment(totalBytesRead);
totalBytesRead = 0;
}
}
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
But at this point, how can I continue my condition in the other loop?
while ((bytesRead = await source.ReadAsync(memory)) > 0)
while ((bytesRead = await source.ReadAsync(memory)) > 0)
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Yes, I understand roughly what that means, I've just never worked with memory management and so I don't know how to do that in C#
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
keep calling ReadAsync until the buffer is (nearly) full
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
How can I do it?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Could it be caused by cloudflare?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
But is it something that happens only during long sessions of use?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
No, but I know the owner
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Thanks, I'll take care of other things in the meantime
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
I installed it but I have no idea how to do it
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Is there a way to confirm this?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
No description
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
No description
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
How can I open it?
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
From the main of a console application
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
And even if it crashes I still have these errors in the console Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Net.Http.dll Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll Exception thrown: 'System.OperationCanceledException' in System.Private.CoreLib.dll Exception thrown: 'System.OperationCanceledException' in System.Private.CoreLib.dll Exception thrown: 'System.OperationCanceledException' in System.Private.CoreLib.dll
69 replies
CC#
Created by Kiriox on 12/22/2024 in #help
Downloading large file
Um, in fact it starts faster and the progress bar reacts well but on the other hand I have the impression that overall it's slower
69 replies