import java.io.*; import java.net.*; public class DateClient { public static final int PORT = 13; // the daytime port public static void main(String[] args) { Socket s = null; String line = null; try { // Create a socket s = new Socket("localhost", PORT); // Create stream for reading this socket. DataInputStream sin = new DataInputStream(s.getInputStream()); line = sin.readLine(); if (line != null) System.out.println(line); } catch (IOException e) {System.err.println(e);} // Always be sure to close the socket finally { try { if (s != null) s.close(); } catch (IOException e2) {} ; } } }