FileDocCategorySizeDatePackage
Client.javaAPI DocExample869Mon May 01 14:41:46 BST 2000None

Client

public class Client extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

    try {
      Socket server =
        new Socket( argv[0], Integer.parseInt(argv[1]) );
      ObjectOutputStream out =
        new ObjectOutputStream( server.getOutputStream(  ) );
      ObjectInputStream in =
        new ObjectInputStream( server.getInputStream(  ) );

      out.writeObject( new DateRequest(  ) );
      out.flush(  );
      System.out.println( in.readObject(  ) );

      out.writeObject( new MyCalculation( 2 ) );
      out.flush(  );
      System.out.println( in.readObject(  ) );

      server.close(  );
    } catch ( IOException e ) {
      System.out.println( "I/O error " + e ); // I/O error
    } catch ( ClassNotFoundException e2 ) {
      System.out.println( e2 ); // unknown type of response object
    }