This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task AnarcodesWebClientLoop(string[] urls) { | |
using (var entryGate = new SemaphoreSlim(10, 10)) { | |
var requests = urls.Select(async url => { | |
await entryGate.WaitAsync(); | |
var didError = false; | |
string errorMessage = null; | |
try { | |
var req = WebRequest.Create(url); | |
using (var res = (HttpWebResponse)await req.GetResponseAsync()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async Task AnarcodesWebClientLoop(string[] urls) { | |
foreach (var url in urls) | |
{ | |
var didError = false; | |
string errorMessage = null; | |
try { | |
var req = WebRequest.Create(url); | |
using (var res = (HttpWebResponse)await req.GetResponseAsync()) | |
{ | |
didError = (int)res.StatusCode < 200 || (int)res.StatusCode >= 300); |
NewerOlder