FileDocCategorySizeDatePackage
Client.javaAPI DocExample774Fri Jul 11 17:24:46 BST 1997None

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
		}