c# - Increase Async HttpClient GetStringAsync speed. Won't make any check difference if I pass different values to check at the same time -


i'm checking on own server if username turns aviable or not. code run in while loop until condition turns true , other code executed.

my problem:

it doesn't matter value store inside int amount parameter. speed of checks remain same.

could caused defaultconnectionlimit or similare?

what want do:

i want increase following value:

int amount = int32.parse(bunifucustomlabel11.text); 

to run more checks @ same time. @ specific point speed wouldn't increase anymore. let's pass value 100 code executed in same speed when entered 200 example.

functions: check current status of handle/username , return true or false:

private async task checkuntiloneoftheusersisavaliable() {     int amount = int32.parse(bunifucustomlabel11.text);     await task.whenany(enumerable.range(0, amount).select(i => checkuntiluserisavaliable()));      // if aviable run other code.. }  private async task checkuntiluserisavaliable() {     while (!await isuseravaliable(bunifumetrotextbox3.text) && changeduser == false)     {         // method_5 increaes label         method_5();         await task.delay(1000);     } }  private async task<bool> isuseravaliable(string handle) {     while (true)     {         using (httpclient client = new httpclient())         {             try             {                 string content = await client.getstringasync("http://urlcom/script.php?user=" + handle);                 return content.contains("no users found");             }             catch (webexception ex)             {                 console.writeline(ex.message);             }         }     } } 

there limitations to

  1. the number of tasks can run in parallel. not 100, or 200.

  2. the number of connections service or hosted server allows same client.

you can write debug log see how many httpclient instances actively talking server.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -