aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Server Port  Vs Local Port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Server Port  Vs Local Port" Watch "Server Port  Vs Local Port" New topic
Author

Server Port Vs Local Port

Sarat Koduri
Ranch Hand

Joined: Jul 08, 2008
Posts: 83
Hi,
some body please clarify the following .. thing..

PortA serverbox PortB

support client has sent a request to porta and finnally it is served by portb.


as per the HFSJ..
Serverport is portA
Local Port is portB

but i hv seen the servlet spect 2.4.. they say ..
Local Port is portA
and there is nothing mentioned related to server port .. so just got confused.

some body kindly tell me which is exactly the Server port and local port..
:roll:
Michael Vargenstien
Ranch Hand

Joined: Jan 27, 2007
Posts: 61
Okay dude, I don't really get your question but I'll let you know the terminology.

getServetPort() basically will return the default port that the server is listening on. So for example, suppose you got Tomcat 5.x/6.x runnin. The default port (out of the box) is 8080. This is the port, teh server is actually listening on.

getLocalPort() is the actual port being used to service the request. Think about one million concurrent requests being sent at the same time. The container (tomcat/websphere/jboss) will internally use a port to actually service the request...why? To handle concurrent requests at the same time.

Remember one servlet, many threads. Ports are communication channels between the container. the app and the OS. They are reserved internally by the container to distinguish each apart. So if concurrent requests are being served, the container will internally use a specific port to service thread A and B.

Hope that helps.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks Michael Vargenstien
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server Port Vs Local Port
 
Similar Threads
request.getLocalPort and the number of client requests
confusion about request's API...
port number in url
ServerSocketChannel.accept() seems to create a random port to send data to?
java.net Socket port number question