package cz.vutbr.feec.session.ping;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * The demo that measures distance to any host.
 */
public class MeasureRttDistanceToHost {
	public static void main(String[] args) throws UnknownHostException,
			InterruptedException {
		if (args.length != 1) {
			System.err.println("USAGE: program hostname");
			System.exit(-1);
		}
		InetAddress addr = InetAddress.getByName(args[0]);

		int count = 3;
		int id = 2000;
		RttMeasurement task = new RttMeasurement(addr, id, count);
		task.run();
		System.out
				.println("Measured host:" + addr + " RTT:" + task.getResult());
	}
}
