package example9_3_RemoteProxy.client; import example9_3_RemoteProxy.dateService.DateService; /** * This application illustrates the use of a proxy that employs sockets * to send a serialized object between two processes. * This app implements the client side. * @author hornick * */ public class ClientApp { public static void main(String[] args) { ClientApp me = new ClientApp(); } public ClientApp() { try { // Create the remote proxy DateService ds = new DateProxy(); while( true ) { // periodically ask the server for time and date // get time and date via the remote proxy from another process String today = ds.getDate(); String time = ds.getTime(); System.out.println("Today is " + today ); System.out.println("Time in ms after 1/1/1970 is " + time ); try { Thread.sleep(2000); } catch (InterruptedException e ) { // continue anyway } } } catch( Exception e ) { System.out.println("Date Server Error: " + e.getMessage() ); } } }