How to find the closest car in terms of latency

I have few servers, and I would like to decide in my java client what is the closest machine (with the shortest time to connect tcp).
Is there a library that does this in java?
If not, what is the best way to do this? I prefer to do this without actually connecting to my server application, if possible.

+4
source share
1 answer

A simple way would be:

InetAddress.getByName(host).isReachable(timeOut)

Or using Http clientif you want to contact the application, not the host.

And measure the time before and after, then sort the hosts.

+3
source

All Articles