• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

RMI question

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I setup an RMI registry on a random port (by giving 0 as port parameter) and then find out wich port was chosen ?

If so, how ?
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. Choose a port such as:
The port numbers are divided into three ranges: the Well Known Ports,
the Registered Ports, and the Dynamic and/or Private Ports.

The Well Known Ports are those from 0 through 1023.
The Registered Ports are those from 1024 through 49151
The Dynamic and/or Private Ports are those from 49152 through 65535
 
Frans Verbeke
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.

The problem is I can't say in advance if a port will be free or not.

So... a solution for me would be to choose a range of ports. For example: 2000 - 2100.
And then start by trying one...if it doesn't work, try another one...and so on, till I find one that works.

Will I get a recoverable(by trying another port) exception when a port isn't free ?
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1099 is a port registered to be the RMI Registry port.

What you're doing is outside anything I know about. Perhaps other will step in here.
 
Frans Verbeke
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it seems 1099 is the standard port for this. Nevertheless I was hoping to be able to choose another port.

In the API docs I found this:



Which makes me think it's possible to choose another port.

Except the RemoteException I don't see any other exceptions listed, so I was wondering if it would be possible to try ports till I find one that's free.

I could be totally wrong here; it's not like I have experience with RMI.

Any input is always appreciated.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you manually start the RMI server (registry) you select the port that you want it to use.

Before you manually start the RMI server (registry) you should know what port you will use.

Your concept of "trying" ports until one is free does not apply to the activity of manually starting the RMI server (registry.)
 
Frans Verbeke
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jimmy Clark wrote:
When you manually start the RMI server (registry) you select the port that you want it to use.
Your concept of "trying" ports until one is free does not apply to the activity of manually starting the RMI server (registry.)



Ok, I guess I'll just have to try it. If necessary I can allways check if a port is free by doing something like the following.



The only problem with this could be something takes the port between me checking if it's free and actually using it with the registry, but the chance on that is small enough.

Maybe you're wondering how I will be able to use this registry if I don't know beforehand what port I'll use...I will probably be sending out udp packets to tell clients what port to use.

Thank you for thinking with me here and sorry for using your time.
 
Politics n. Poly "many" + ticks "blood sucking insects". 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