• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server Port Vs Local Port

 
Sarat Koduri
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael Vargenstien
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic