I am not using the port number parameter, we can request from the user. When I start the server, I use Naming.rebind("serverName", Object) and when the client connects to the server, it uses: Naming.lookup("rmi://ipAddress/serverName"); Where ipAddress is the IP address without a port number. So is the port field necessary? Does the RMI client seek out the first available RMI server at that IP address with that name? Can errors occur if the port number is not specified? Thanks, Steve
Thanks Mark. FYI: I did a little research into this area. As you stated, the RMI server will default to port 1099 if the default UnicastRemoteObject constructor is used. Likewise, serveral RMI servers can be loaded onto one port, with the server name being the unique identifier. Consequently, when using rebind(String, Object) to specify the server name (String), the method will fail if the name already exists. If no port is specified on the client side (in the rmi url), the lookup(String) method will search on port on the default port. So it would appear for this program, a port does not need to be specified, but the server should ensure the Server name is unique before trying to rebind. Also, as a side note, the default RMI port can be switched by specifying this in the command line, for example: $ rmiregistry 10123 will use port 10123 as the default port. I hope this research is useful to anyone else with port questions.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.