Originally posted by naresh bv:
I want to get the port number of a server dynamically.
For ex: If I use tomcat server then I will get port number as 8080
If I use WebLogic then that will be 7001, so on....
How can i get that port number in normal java file.
I could not get the questions properly.
Well 8080 is the default port for Tomcat and can always be changed.
One more confusing thing is normal java file ?
Do you mean a standalone program making request to server.
In that case you can have a configuration file which will have port numbers and server type.Can you can change the program to read the port number and host name where the server is located from the configuration file and construct the request dynamically.
There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.