How to determine the IP address of the requesting client?

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

+7
source share
2 answers

In the Java servlet, you can use request.getRemoteAddr() :

 public void doGet(HttpServletRequest req, HttpServletResponse resp) { String ipAddress = req.getRemoteAddr(); } 
+10
source

If you use Appengine with Go , Request contains the address in the RemoteAddr line field:

 import ( "fmt" "net/http" ) func init() { http.HandleFunc("/", handler) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, r.RemoteAddr) } 
+2
source

All Articles