Dynamically Ping an IP address in Web Application

I want to ping an IP address dynamically.
the IP address is belong to web server where my API is hosted. I want to check if the Server is up then call the API else not. because it's taking some time.



So what is your question?

you can create an extension that fires up a ping in a process.

But dunno if that is the best way.

I don't understand why you cannot call the api directly still.

1. call ping (takes some time)

2. call webservice or not


1. call webservice (success or no success)

When server is off then API gives the time out error after 30 sec or more. But it want to check in 'IF' if the server is off then not calling API.