I still have a doubt. Doesn't every servlet have a port on which it waits for requests to come when it is initialized (I am sorry if that was a naive thing to ask). Since it is server side, it needs to behave like an application that listens on some port and accepts connection requests from client.
Few notes to add. Isn't it possible to access a Bootstrap port during the init to get the number. I am not referring to the ports assigned to multiple request but, referring to the ORB Bootstrap port at server side.
Originally posted by Sumesh Kumar: Doesn't every servlet have a port on which it waits for requests to come when it is initialized (I am sorry if that was a naive thing to ask).
No. Servlets don't wait for requests at all. It's the container (Tomcat, Websphere, etc) that waits for requests, and when it gets a request then it passes the request to the servlet designated to handle it.
And as Ben already said, the container may wait for requests on several ports.
Really those port numbers are none of the application's business. Why do you think your servlet needs to know it?
The scenario is a bit different from the usual servlets that we see.
I have an application server, which when started will load a servlet. However, on startup, only the init will be executed. The port that I am referring to is the ORB Bootstrap port that is found in server.xml file which contains all the properties of the server.
Questions on using container-proprietary features (which I would personally advise against using) should be asked in the forum for the specific container. Please post a new question in the Websphere forum.