Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Server uygulaması main method
package simplechat;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import simplechat.common.ChatServer;
import simplechat.common.Server;
* @author Kadir Korkmaz
public class ServerApp {
public static void main(String[] args) throws IOException, RemoteException, AccessException, AlreadyBoundException {
System.out.println("Creating RMI registry");
Runtime.getRuntime().exec("rmiregistry 2020");
System.out.println("Creating Server Object");
Server chatServer = new Server();
ChatServer serverStub = (ChatServer) UnicastRemoteObject.exportObject(chatServer, 0);
System.out.println("Registring Server object to registry");
// Bind the remote object's stub in the registry
Registry registry = LocateRegistry.getRegistry(2020);
registry.bind("ChatServerObject", serverStub);
System.out.println("Server ready...");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment