aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes difference between getServerPort and getLocalPort 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 "difference between getServerPort and getLocalPort" Watch "difference between getServerPort and getLocalPort" New topic
Author

difference between getServerPort and getLocalPort

avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

i was reading the Api specification and i found :



and



what i know is that Local port is the port where the request was made and server port is the port where the response was given by the server.
i got confused by the lines :
Localport --> which the request was received
serverport ---> the client connection was accepted on.

i think i am missing something .please help.

avi sinha


SCJP 5.0 SCWCD 5.0
mingt sun
Greenhorn

Joined: Nov 26, 2009
Posts: 6
I don't know either. However, for the exam, I don't think you really need to understand the difference. Understanding the difference between getRemotePort() and getServerPort()/getLocalPort() is enough.
Niteen Patil
Ranch Hand

Joined: Oct 27, 2009
Posts: 45
Remembering the methods provided in the API.

Hi Ranchers,
Will some one provide me the details of what is expected related to the API and which methods are to be known.
Interface or class name , method and the explanation of the method for each interface or class.
Thanks.
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

mingt sun wrote: Understanding the difference between getRemotePort() and getServerPort()/getLocalPort() is enough.


i am just trying to do the above my friend.

avi sinha
mingt sun
Greenhorn

Joined: Nov 26, 2009
Posts: 6
I meant all you need to know is getRemotePort() is the port on client side, getServerPort() and getLocalPort() are the port on server side. As far as the difference between getServerPort() and getLocalPort(), I don't think it's one of the exam objectives. At least I never came accross questions on this, of more than 1000 practice questions.
mingt sun
Greenhorn

Joined: Nov 26, 2009
Posts: 6
Nitinyanand Patil wrote:Remembering the methods provided in the API.

Hi Ranchers,
Will some one provide me the details of what is expected related to the API and which methods are to be known.
Interface or class name , method and the explanation of the method for each interface or class.
Thanks.


Well, that's hard to say exactly which methods are on/off the exam. Could getPathTranslated() be on the exam? yes, it could, but very unlikely. But we surely expect to see getCookies().

I guess ServletRequest, ServletResponse, HttpServletRequest, HttpServletResponse, ServletContext, ServletConfig, all 8 listerners are among the most important classes/interfaces.

Also it is critical to memorize all implicit objects for EL and jsp.
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Nitinyanand Patil wrote:Remembering the methods provided in the API.

Hi Ranchers,
Will some one provide me the details of what is expected related to the API and which methods are to be known.
Interface or class name , method and the explanation of the method for each interface or class.
Thanks.


if you are reading HFS them be sure to know each and every method mentioned.
also you should go through SCWCD_API

and the most important thing Don't study to crack the exam . do it to gain expertise over the objectives.
the reason is that these things will help you further.

avi sinha
Niteen Patil
Ranch Hand

Joined: Oct 27, 2009
Posts: 45
avi sinha wrote:
Nitinyanand Patil wrote:Remembering the methods provided in the API.

Hi Ranchers,
Will some one provide me the details of what is expected related to the API and which methods are to be known.
Interface or class name , method and the explanation of the method for each interface or class.
Thanks.


if you are reading HFS them be sure to know each and every method mentioned.
also you should go through SCWCD_API

and the most important thing Don't study to crack the exam . do it to gain expertise over the objectives.
the reason is that these things will help you further.

avi sinha

Hi Avi Sinha,
I know that Ashok_SCWCD_API is the one to which we can refer to the API(not http://esnault.frederic.free.fr/certification/scwcd_notes.pdf).
I want to know the way by which we can gain expertise over the objectives as stated by you.
Also we can't ignore the fact that to get good score(not just cracking the exam) we have to remember the API.
Please share some tips thr' which we can do that.
Thanks.
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Nitinyanand Patil wrote:
Also we can't ignore the fact that to get good score(not just cracking the exam) we have to remember the API.
Please share some tips thr' which we can do that.
Thanks.

for getting a good score you should know the api. you should figure out how the api works not just remembering it.


in servlets and jsp you can figure out the interface or classes a method can belong.
i am giving you an example :
getHeader/getHeaderNames/getHeaders and all header related methods : they can't reside in ServletRequest interface because this interface is not related to HTTP.

just follow my suggestion and you will not have to memorize everything.

avi sinha
Niteen Patil
Ranch Hand

Joined: Oct 27, 2009
Posts: 45
Thanks avi sinha.
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
If we say getServerPort() it 'returns the port number to which the request was sent'. If we hosted server on port no. 8080 and made a request to it. Then the request goes to the port no. 8080. The getServerPort() returns that port number. For details of getLocalPort() method, see this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between getServerPort and getLocalPort