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.