0

I am developing an Android app with an integrated webserver; in my handler (implements HttpRequestHandler) I want to retrieve the remote IP address. How can I do that ?

public abstract class MyHttpRequestHandler implements HttpRequestHandler {

@Override
public void handle(HttpRequest request, HttpResponse response,
        HttpContext httpContext) throws HttpException, IOException {
 // retrieve remote IP here...
mmBs
  • 8,421
  • 6
  • 38
  • 46
Anthony
  • 325
  • 2
  • 5
  • 15

1 Answers1

0

Are you able to pull the headers off the server? Although not always 100% accurate, refer to this article, it has some headers you can check:

Getting the client IP address: REMOTE_ADDR, HTTP_X_FORWARDED_FOR, what else could be useful?

Community
  • 1
  • 1
Geremy
  • 2,415
  • 1
  • 23
  • 27