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.

36 lines
1.1 KiB

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