• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

port field

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't include port number. The RMIRegistry by default starts on port 1099. I took the default and used that.
Mark
 
steve nicholls
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
We can walk to school together. And we can both read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic