How do I test if a adress is up and the response time


I tried to find a description of the api that lets you check last response time, and if a server is up.

In my program I want to check if the server is up that is about to process my image. Is there a recommended way for this?

If it is down I would try one of the other servers.

Also if one has response time over, let us say, 5 sek, I would like to choose another one. Is there a recommended way of getting the latest response time?

Thank you!

Here is some example code from the open-source Copyfish OCR tool. It uses the OCR API.

Copyfish OCR API calls:

It uses 3 OCR API endpoints. It first rotates them (different one for each call) and then uses the fastest one. After a certain time (one day) or if one endpoint is down, it tests again.

Our Kantu tool uses the same logic for its screen scraping with OCR feature.

Thank you! Will try that. Thank you for the code example.