views:

393

answers:

2

Given a list of servers & a list of clients, how to find a server that is closest to a particular host using "traceroute"? The program should be in java.

+1  A: 

What do you define as "closest"? Lots of hops in a traceroute do not indicate closeness just devices the packet routes through. Ping is also not too great as it just shows latency.
What I would suggest is if you are on the web use BGP to work out closeness. If you are on a lan or you get a tie with BGP then fall back to Traceroute.

Those links go to Java implementations of BGP and traceroute.

Robert MacLean
A: 

I don't think it can be done using only the standard Java API, since it does not support the ICMP protocol sufficiently. You may be able to do it using Jpcap.

Michael Borgwardt