import java.io.*; import java.net.*; /** * Tiny socket client for the Unix 'daytime' protocol. */ public class Dayclient { public static void main(String[] args) { Socket csocket; BufferedReader timestream; if (args.length < 1) { System.err.println("Please supply a host name or IP address"); System.exit(0); } try { csocket = new Socket(args[0],13); timestream = new BufferedReader(new InputStreamReader(csocket.getInputStream())); String thetime = timestream.readLine(); System.out.println("it is "+ thetime + " at " + args[0]); csocket.close(); } catch(IOException e) { System.err.println(e);} } }