-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
24 lines (20 loc) · 766 Bytes
/
Server.java
File metadata and controls
24 lines (20 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class Server{
public static String name = "Server";
public static String hostname = "localhost";
public static int port = 3000;
public static void main(String[] args) throws RemoteException, AlreadyBoundException {
ServerIn server = new RemoteServer();
hostname=args[0];
port=Integer.parseInt(args[1]);
Registry registry = LocateRegistry.createRegistry(port);
registry.bind(name, server);
System.out.println("ChatRoom activated.");
}
}