[appengine-java] Re: How to get IP address of Appengine running my java servlet page

2010-03-29 Thread Didier Durand
Hi, check out class java.lang.System:  you can get various system
properties.
didier

On Mar 29, 4:30 pm, "powell...@gmail.com"  wrote:
> I am trying to get a sense of where (location) the Appengine is
> running my servlet to show how the cloud runs my servlet in different
> locations. I have tried to use request.getLocalAddr() but get back
> null. I tried getServletContext().getServerInfo() but did not get back
> an IP address. Any ideas?
>
> Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get IP address of Appengine running my java servlet page

2010-03-30 Thread Didier Durand
Hi Dave,

A very straightforward solution: call getHardwareAddress() of
java.net.NetworkInterface.

NetworkInterface is part of the JRE class white list for GAEJ:
http://code.google.com/appengine/docs/java/jrewhitelist.html

This way, you get the MAC address of the network card of the machine.
This MAC address is unique worldwide. So, you can distinguish the
various machines that you are running on.

regards
didier

On Mar 29, 7:57 pm, Jeff Schnitzer  wrote:
> It seems quite unlikely that GAE appservers are going to have public
> IP addresses.  Even if you can get the IP address of the host (and I
> suspect this is impossible), it's going to be a private address.
>
> The best you will probably be able to do is get the NATed apparent
> address of the URLFetch servers.  Make a URLFetch request to a server
> you run somewhere and check the source IP address in the logs.
>
> This isn't necessarily a good piece of data, though.  For one, this is
> simply going to be an outbound public IP.  The request could have been
> routed around the world through Google's private network before it
> found an outbound node.  For another, it's going to come from the
> URLFetch service... and there is no guarantee that the URLFetch server
> is the same box (or even located anywhere near) the box your app runs
> on.
>
> It's an opaque system - deliberately so.
>
> Jeff
>
> On Mon, Mar 29, 2010 at 9:43 AM, Didier Durand  
> wrote:
> > Hi, check out class java.lang.System:  you can get various system
> > properties.
> > didier
>
> > On Mar 29, 4:30 pm, "powell...@gmail.com"  wrote:
> >> I am trying to get a sense of where (location) the Appengine is
> >> running my servlet to show how the cloud runs my servlet in different
> >> locations. I have tried to use request.getLocalAddr() but get back
> >> null. I tried getServletContext().getServerInfo() but did not get back
> >> an IP address. Any ideas?
>
> >> Dave
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: How to get IP address of Appengine running my java servlet page

2010-03-29 Thread Jeff Schnitzer
It seems quite unlikely that GAE appservers are going to have public
IP addresses.  Even if you can get the IP address of the host (and I
suspect this is impossible), it's going to be a private address.

The best you will probably be able to do is get the NATed apparent
address of the URLFetch servers.  Make a URLFetch request to a server
you run somewhere and check the source IP address in the logs.

This isn't necessarily a good piece of data, though.  For one, this is
simply going to be an outbound public IP.  The request could have been
routed around the world through Google's private network before it
found an outbound node.  For another, it's going to come from the
URLFetch service... and there is no guarantee that the URLFetch server
is the same box (or even located anywhere near) the box your app runs
on.

It's an opaque system - deliberately so.

Jeff

On Mon, Mar 29, 2010 at 9:43 AM, Didier Durand  wrote:
> Hi, check out class java.lang.System:  you can get various system
> properties.
> didier
>
> On Mar 29, 4:30 pm, "powell...@gmail.com"  wrote:
>> I am trying to get a sense of where (location) the Appengine is
>> running my servlet to show how the cloud runs my servlet in different
>> locations. I have tried to use request.getLocalAddr() but get back
>> null. I tried getServletContext().getServerInfo() but did not get back
>> an IP address. Any ideas?
>>
>> Dave
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.