示例#1
0
  /** A test client. */
  public static void main(String[] args) {
    Out out;
    String s;

    // write to stdout
    out = new Out();
    out.println("Test 1");
    out.close();

    // write to a file
    out = new Out("test.txt");
    out.println("Test 2");
    out.close();
  }
示例#2
0
 public void close() {
   System.err.println("Closing connection with client");
   out.close();
   in.close();
   try {
     server.close();
   } catch (IOException ioe) {
     System.out.println("IOException on socket listen: " + ioe);
     ioe.printStackTrace();
   }
 }