public class ServerImplementation extends NetworkPeer implements Server, java.rmi.Remote { Client clients[] = new Client[100]; int index = -1; synchronized public int register(Client client) throws java.rmi.RemoteException { clients[++index] = client; return index; } synchronized public void broadcast(Update event) throws java.rmi.RemoteException { for (int i = 0; i <= index; i++) clients[i].update(event); } public static void main(String[] args) { String portNumber = args[0], ownName = args[1]; ServerImplementation here = new ServerImplementation(); here.startAsNetworkServer(ownName, Integer.parseInt(portNumber)); } public void startAsClientOf(java.rmi.Remote peer) throws java.rmi.RemoteException { } public String list() throws java.rmi.RemoteException{ String result = ""; for (int i = 0; i <= index; i++) result += " ***(" + clients[i].name() + ")*** \n"; return result; } public void startAsLocalServer() { } }