C#
using System.IO;
using System.Net.Http;
Console.WriteLine("Hello, World! v3");
static async Task GetRequest(string url)
{
using (var httpClient = new HttpClient())
{
try
{
using (var response = await httpClient.GetAsync(url))
{
var stream = await response.Content.ReadAsStreamAsync();
await stream.CopyToAsync(Stream.Null);
}
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
const string URL_TO_GET = "https://speed.cloudflare.com/__down?measId=0&bytes=50000000";
List<Task> tasks = new List<Task>();
for (int i = 0; i < 8; i++)
{
tasks.Add(GetRequest(URL_TO_GET));
}
await Task.WhenAll(tasks);
Console.WriteLine("Work Complete!");