*** iCALENDAR *** import java.rmi.*; public interface iCalendar extends Remote { java.util.Date getDate () throws RemoteException; } *** CALENDAR USER *** import java.util.Date; import java.rmi.*; public class CalendarUser { public CalendarUser() {} public static void main(String args[]) { long t1=0,t2=0; Date date; iCalendar remoteCal; try { // Note, you need to change the machine // name in the following call. If you // are running both the client and // server on the same machine, you // can use: "rmi:///CalendarImpl". // If the server is running on a different // machine you need to change // 'ctr.cstp.umkc.edu' to the name of // the machine the server is running on. // remoteCal = (iCalendar) Naming.lookup("rmi:///CalendarImpl"); t1 = remoteCal.getDate().getTime(); t2 = remoteCal.getDate().getTime(); } catch (Exception e) { e.printStackTrace(); } System.out.println("This RMI call took " + (t2-t1) + " milliseconds"); } } *** CALENDAR IMPL *** import java.util.Date; import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; public class CalendarImpl extends UnicastRemoteObject implements iCalendar { public CalendarImpl() throws RemoteException {} public Date getDate () throws RemoteException { return new Date(); } public static void main(String args[]) { CalendarImpl cal; try { LocateRegistry.createRegistry(1099); //Registry registro = LocateRegistry.getRegistry("161.24.1.233", 1099); cal = new CalendarImpl(); //registro.bind("CalendarImpl", cal); Naming.bind("rmi:///CalendarImpl", cal); System.out.println("Ready for RMI's"); } catch (Exception e) { e.printStackTrace(); } } }