The solution above only says if you have a valid Internet connection - it is assumed that Google.com is available. if you want to check the availability of a group of websites, you will need to check each of them separately - and then you are stuck with timeout restrictions.
One solution is to run 20 background tasks for simultaneous access to each website and create a common response as the results arrive.
Depending on your application, it may be fair to do the entire block of 20 in one background task - if you can start it early enough in your process, maybe it doesnβt matter that it takes a lot of time - only this does not delay the user.
source share