Вопрос

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...

Нет правильного решения

Другие советы

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?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top