Browse Source

added handling to listen under IP addresses other than 127.0.0.1

master
Sebastian Rieger 7 years ago
parent
commit
5cee352894
  1. 23
      VerteilteSysteme-Examples/src/verteiltesysteme/mandelbrot/rmi/RMIMandelbrotCalculationsServer.java

23
VerteilteSysteme-Examples/src/verteiltesysteme/mandelbrot/rmi/RMIMandelbrotCalculationsServer.java

@ -1,9 +1,28 @@
package verteiltesysteme.mandelbrot.rmi; package verteiltesysteme.mandelbrot.rmi;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.rmi.registry.LocateRegistry; import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry; import java.rmi.registry.Registry;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.UnicastRemoteObject; import java.rmi.server.UnicastRemoteObject;
/*
class LoopbackSocketFactory extends RMISocketFactory {
public ServerSocket createServerSocket(int port) throws IOException {
return new ServerSocket(port, 5, InetAddress.getByName("127.0.0.1"));
}
public Socket createSocket(String host, int port) throws IOException {
// just call the default client socket factory
return RMISocketFactory.getDefaultSocketFactory()
.createSocket(host, port);
}
}
*/
class Complex { class Complex {
double r; double r;
double i; double i;
@ -45,6 +64,8 @@ public class RMIMandelbrotCalculationsServer implements RMIMandelbrotCalculation
public static void main(String args[]) { public static void main(String args[]) {
try { try {
//RMISocketFactory.setSocketFactory(new LoopbackSocketFactory());
RMIMandelbrotCalculationsServer obj = new RMIMandelbrotCalculationsServer(); RMIMandelbrotCalculationsServer obj = new RMIMandelbrotCalculationsServer();
RMIMandelbrotCalculationsInterface stub = (RMIMandelbrotCalculationsInterface) UnicastRemoteObject.exportObject(obj, 0); RMIMandelbrotCalculationsInterface stub = (RMIMandelbrotCalculationsInterface) UnicastRemoteObject.exportObject(obj, 0);
@ -127,4 +148,4 @@ public class RMIMandelbrotCalculationsServer implements RMIMandelbrotCalculation
this.LRy = LRy; this.LRy = LRy;
} }
}
}
Loading…
Cancel
Save