import java.io.*; import java.net.*; import java.util.*; import Kbd; class EchoTime { public static void main(String[] args) throws IOException { Kbd k = new Kbd(); System.out.println(args[0]); Socket t = new Socket(args[0], 7); // 7 is the echo port int size = Integer.parseInt(args[1]); String str = new String("+"); // build the buffer for (int i = 0; i < size-2; i ++) str = str + "."; str = str + "+"; DataInputStream is = new DataInputStream(t.getInputStream()); PrintStream out = new PrintStream(t.getOutputStream()); DataInputStream in = new DataInputStream(System.in); Date d = new Date(); long start = d.getTime(); out.println(str); str = is.readLine(); d = new Date(); long end = d.getTime(); System.out.println(str); System.out.println(" echoing " + size + " bytes used "+ (end - start) + " mili-seconds"); k.waitKeyPress(); } // main }