Take the 2-minute tour ×

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

A simple way would be:


Or with an Http client if you are willing to reach for an application rather than a host.

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

share|improve this answer

Your Answer


