Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify IP address of requesting client?

How does a server actually identify the requesting client address (IP), and send a response? Is it possible to get the IP address of requesting client in GAE?

like image 973
Vivek Mohan Avatar asked Jan 09 '12 11:01

Vivek Mohan


People also ask

How do I get client IP from request?

To obtain the IP address of users on your original servers, we have added two HTTP headers to requests to your server: X-Forwarded-For ou True-Client-IP. The X-Forwarded-For header is a list of IP addresses that forwarded the request. The first IP address is the IP address of the browser.

How do I find the IP address of my client?

After the client establishes a successful connection to the server, the IP address of the client will be printed on the server console.

How do you identify someone's IP address?

Use an IP lookup tool Starting with the simplest way to find someone's IP address is to use one of the many IP lookup tools available online. Resources such as WhatIsMyIPAddress.com or WhatIsMyIP.com offer tools to enter an IP address and search for its free public registry results.

What is the IP address of the client?

Client IP addresses describe only the computer being used, not the user. If multiple users share the same computer, they will be indistinguishable. Many Internet service providers dynamically assign IP addresses to users when they log in.


1 Answers

In a Java servlet you could use request.getRemoteAddr():

public void doGet(HttpServletRequest req, HttpServletResponse resp) {
    String ipAddress = req.getRemoteAddr(); 
}
like image 89
Peter Knego Avatar answered Oct 02 '22 22:10

Peter Knego