This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getServerPort() vs getLocalPort() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getServerPort() vs getLocalPort()" Watch "getServerPort() vs getLocalPort()" New topic
Author

getServerPort() vs getLocalPort()

Rajan Chinna
Ranch Hand

Joined: Jul 01, 2004
Posts: 320
In which context these two methods are used on request object? Whats the difference?
Thanks
ming wu
Ranch Hand

Joined: Oct 11, 2004
Posts: 59
getServerPost() says, "to which port was the request originally sent?"
getLocalPost() says, "on which port did the request end up with?"

all request are send to a single port(server port), where the server is listening. then the server find another port(Local port) to handle this thread, so that the app server can handle many client at the sametime.


SCJP,SCWCD,SCBCD<br />Oracle 10g OCA DBA in progress<br />------------------------<br />Good judgement comes from experience, and experience comes from bad judgement.
Rajan Chinna
Ranch Hand

Joined: Jul 01, 2004
Posts: 320
It means this is useful when we configure Apache & Tomcat together.

Lets say I configure Apache at port 80 and Tomcat at port 8080, can i say getServerPost() refers to port 80 and getLocalPost() refers to 8080 port.

Am I right in understanding this?

Lets say I use only Tomcat at port 80 in this case I cannot use getLocalPost() rite?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getServerPort() vs getLocalPort()