views:

92

answers:

4

can anybody let me know the logic they use to get the ip?

+8  A: 

The server has to know your IP address to send you a response. That is how the internet works. Presumably they store the IP address for the last account activity in a database somewhere.

Turtle
+1. Nothing magic here. Every service provider on the Internet knows its users' IP addresses.
Thilo
A: 

When your browser connects to their web site, their HTTP server determines the IP address from the connected socket. That IP address is supplied to Google's web application framework, which stores the IP address in some kind of data store, so that it can be retrieved later. I can't give you much more detail, since I don't work for Google (and even if I did, I probably wouldn'couldn't).

Will
A: 

sorry i was talking about the gmail , where you can see a link

"Last account activity: 42 minutes ago at this IP (76.73.38.3). Details".

Is this a real ip.i do not think so. how are they managing to get the ip address , ie. router ip and they are closing off the session opened elsewhere.

Suresh S
Why would it not be a real IP? Like Turtle stated, the server has to have an IP to send you data back when you request it. So if the IP is not real then you would not be accessing the page. What GMail does is store the IP address that was used to access the information and what time it was requested, then when additional requests are sent, it outputs the IP address and how long ago the request was made.
animuson
Welcome to SO. Please do not post remarks as answers, SO doesn't work like a forum. Rather edit your question. :) Why do you think this IP is not real? Turtle's answer is correct.
deceze
i am accessing gmail from a company's network .so the ip would be the same as router ip, not the real ip.
Suresh S
Google is only using the information that came with the request, I highly doubt they're trying to backtrace requests or search for "deeper" IPs in any way. Also, `76.x.x.x` looks like a valid, public /8 network address, not an internal NAT'ed address.
deceze
A: 

request.getRemoteHost();

this method in the request object will return the ip address of the client.

karthikeyan b