April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
A simple client (simplified code)
n// SimpleClient.java: a simple client program
nimport java.net.*;
nimport java.io.*;
npublic class SimpleClient {
n  public static void main(String args[]) throws IOException {
n    // Open your connection to a server, at port 1234
n    Socket s1 = new Socket("mundroo.cs.mu.oz.au",1234);
n    // Get an input file handle from the socket and read the input
n    InputStream s1In = s1.getInputStream();
n    DataInputStream dis = new DataInputStream(s1In);
n    String st = new String (dis.readUTF());
n    System.out.println(st);
n    // When done, just close the connection and exit
n    dis.close();
n    s1In.close();
n    s1.close();
n  }
n}
n