File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServlerRequest Methods

 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am reading API I have got the following methods and descriptions.
getServerPort : Returns the port number to which the request was sent
getServerName : Returns the host name of the server to which the request was sent.

getRemotePort : Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
getRemoteAddr :Returns the Internet Protocol (IP) address of the client or last proxy that sent the request
getRemoteHost: Returns the fully qualified name of the client or the last proxy that sent the request.

getLocalName:Returns the host name of the Internet Protocol (IP) interface on which the request was received.
getLocalPort :Returns the Internet Protocol (IP) port number of the interface on which the request was received.
getLocalAddr : Returns the Internet Protocol (IP) address of the interface on which the request was received.


Server represents server
Remote represents client

What about Local?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not write a simple servlet and print those values to the console? That should provide an answer in minutes.
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hint is that server assigns a different port for communication once it has accepted the connection.

e.g.
A service is listening on port 100 and it accepts a connection from a user. Now further data transfer may be made through port 110 as 100 is used for listening to other users' request (you don't want a server that serves single user at a time)

Now read the servlet specification for more clarity on what does local represent.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sandeep Bhandari
 
Arunkumar Durairaj
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Local and server both are technically same,but differ logically in the function it does.Both of them are remote to client as said earlier.Addressing your query,Server may be thought of possessing many logical ports.Local here represents the port on which requested service is provided .On the other hand server port receives the incoming request but doesn't provides any response in reply to request !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic