File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Choosing server port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Choosing server port" Watch "Choosing server port" New topic
Author

Choosing server port

David Abramowicz
Ranch Hand

Joined: Dec 10, 2004
Posts: 56
Question...

Is allowing the user to choose server port a MUST??? I don't think it is, I just want to make sure.

I was thinking of allowing the manual setting of port in the Server GUI, but after reading previous posts it seems impossible to change registry to a different port without restarting the JVM.

This has led me to conclude that it would be pretty ugly to include the choice unless I have to...

Any thoughts or opinions would be appreciated.

Cheers /Dave
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
I definitely think you should allow the User to choose the port when starting the server. It's not guaranteed that every User will have the default port that you choose open, therefore you should let them decide what port to run the server on. And because of that, you're going to have to allow the Client to choose the server port to connect to as well.
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
In a real world application, I would definately allow the port to be configurable. However, for the purpose of this assignment, I don't think it is neccessary. If you want to do it, go ahead. If you want to leave it out for simplicity's sake, that is fine too.

FYI, I am pretty sure you are correct David, you cannot change the registry to a different port without restarting the JVM.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
dennis du
Ranch Hand

Joined: Dec 31, 2004
Posts: 59
----------------------
FYI, I am pretty sure you are correct David, you cannot change the registry to a different port without restarting the JVM.
-----------------------------------------
What do you mean? restarting the JVM?? How come?
You only should do is : restart your application ,choose a new port.

or you should >rmiregistry new_port


-------------------------------<br />OCP 9i <br />SCJP/SCJD/SCWCD(92%)/SCDJWS<br />XML(IBM Test 141)<br />Who is the next?SCBCD<br />SCBCD/CCNA/CCNP/PMP<br />not sure
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
What do you mean? restarting the JVM?? How come?
You only should do is : restart your application ,choose a new port.
Yes, that is what I was referring to. For more info, check out
this thread.
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Paul Bourdeaux:
Yes, that is what I was referring to. For more info, check out
this thread.


Since I wrote that reply in that thread I've changed my server to have a GUI and allow changing the port. What I do is let the user specify a new port , but inform her that she will need to restart the server for that change to be effective. This behaviour is common for Windows configuration changes and should be no surprise to a network admin, it's also infrequent. After even more research, including hacking some low level stuff, I can confirm that that ObjID prevents you from closing a registry that you have opened in your application and starting another one.

If you really want to do this you can use Runtime.exec("rmiregistry") and fight all those problems with platform dependencies and controlling a seperate process.

Or you can take the easy way out and just use port 1099, be sure to explain why you chose this one.
[ January 28, 2005: Message edited by: peter wooster ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Choosing server port
 
Similar Threads
accessing Tomcat from a remote server
Server UI
Should server configuration be provided by suncertify.properties ?
NX:Some Questions(URLyBird1.3.2)
(B&S) Clarification on requirements