import java.awt.*; import javax.swing.*; //import OraclePinger.Connector; import OraclePinger.*; // a mod of : http://docs.oracle.com/javase/1.4.2/docs/guide/nio/example/Ping.java import java.util.LinkedList; /* This skeleton app creates a window frame with a chart panel. Extend * this class and add more classes to complete the challenge. */ public class LatencyChallenge { // The port we'll actually use static int port = 80; static String[] host = {"google.com", "yahoo.com"}; static int datapoints = 6; //private final JFrame frame; private static final JFrame frame = new JFrame("Latency Challenge - by kendy"); private static int w; public static void main(String[] args) throws Exception /*, InterruptedException, IOException */ { // Create the targets List LinkedList targetList = new LinkedList(); int[][] pockets = new int[host.length + args.length][datapoints]; ChartPanel chartpanel = new ChartPanel(); chartpanel.dim2 = datapoints; frame.setSize(datapoints*50+20, 360); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.pack(); frame.getContentPane().add(new JLabel("yahoo.com vs google.com latency")); frame.getContentPane().add(chartpanel); frame.setVisible(true); w = 0; //flag to the chartPanel- data points are new while(true) { if (w1){ for (int i=0;i