aspose file tools*
The moose likes Servlets and the fly likes To retrieve port no and name from req obj Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "To retrieve port no and name from req obj" Watch "To retrieve port no and name from req obj" New topic
Author

To retrieve port no and name from req obj

Raja Ratnam Karuppusamy
Greenhorn

Joined: Nov 23, 2007
Posts: 4
A request from client named tom with ip address:10.23.10.11 on port number 4242.From which methods on the request object would you retrieve the ip address value,the port value and the client name?
[ February 25, 2008: Message edited by: Raja Ratnam Karuppusamy ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The client name is not sent.
You should be able to find the rest by looking at this page in the API.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html

I believe getRemoteAddr is the one you're looking for.
-Ben

PS:
Please see Bear's note in your other post about using real words here.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Raja Ratnam Karuppusamy
Greenhorn

Joined: Nov 23, 2007
Posts: 4
thanks for the reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To retrieve port no and name from req obj