You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. package verteiltesysteme.rmi;
  2. import java.rmi.*;
  3. import java.rmi.server.*;
  4. import java.rmi.registry.*;
  5. public class RMIEchoServer implements RMIEchoInterface {
  6. public RMIEchoServer() {}
  7. public static void main(String args[]) {
  8. try {
  9. RMIEchoServer obj = new RMIEchoServer();
  10. RMIEchoInterface stub = (RMIEchoInterface) UnicastRemoteObject.exportObject(obj, 0);
  11. // Bind the remote object's stub in the registry
  12. Registry registry = LocateRegistry.getRegistry();
  13. registry.bind("RMIEchoInterface", stub);
  14. System.err.println("Server ready");
  15. } catch (Exception e) {
  16. System.err.println("Server exception: " + e.toString());
  17. e.printStackTrace();
  18. }
  19. }
  20. @Override
  21. public String toLowerCase(String input) throws RemoteException {
  22. return input.toLowerCase();
  23. }
  24. @Override
  25. public String toUpperCase(String input) throws RemoteException {
  26. return input.toUpperCase();
  27. }
  28. }