I have the server thread below, and for identification I am using port 2099. When I am adding the objects to the stub, why do I have to add port 0 as the second argument in the UnicastRemoteObject.exportObject() method?
public static Thread SERVER_THREAD = new Thread(new Runnable() {
       public void run() {
           //write your code here
           try {
               registry = LocateRegistry.createRegistry(2099);
               Cat cat = new Cat("Cozo");
               Dog dog = new Dog("Chucky");

               Remote stub = UnicastRemoteObject.exportObject(cat, 0);
               registry.bind("class.cat", stub);
               stub = UnicastRemoteObject.exportObject(dog, 0);
               registry.bind("class.dog", stub);

           } catch (RemoteException | AlreadyBoundException e) {