Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6249103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:10:38+00:00 2026-05-24T13:10:38+00:00

Sounds funny, but how can I get the external IP address from a client?

  • 0

Sounds funny, but how can I get the external IP address from a client?

I tried few things, but didn’t work for me.

in first place I tried

request.getRemoteAddr()

and I am getting the result as: 0:0:0:0:0:0:0:1

in second place I tried

InetAddress ip = InetAddress.getLocalHost();
ip.getHostAddress());

and I am getting the result as: 127.0.0.1

in third place I tried

        URL whatismyip = new URL("http://checkip.dyndns.org:8245/");
        BufferedReader inIP = new BufferedReader(new InputStreamReader(whatismyip.openStream()));

        String IPStrOld = inIP.readLine(); //IP as a String
        String IPStrNewest = IPStrOld.replace("<html><head><title>Current IP Check</title></head><body>Current IP Address: ", "");
        String IPStr = IPStrNewest.replace("</body></html>", "");

but I get the external IP of the server only

and for the last place

        URL whatismyip = new URL("http://automation.whatismyip.com/n09230945.asp");
        BufferedReader inIP = new BufferedReader(new InputStreamReader(whatismyip.openStream()));
        String ip = inIP.readLine();

this is the same, I get the external IP of the server only

So, what’s the deal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:10:38+00:00Added an answer on May 24, 2026 at 1:10 pm

    If your client is using NAT (network address translation) it may not have an external address. Most often, in my experience, this is the case. At work, my web requests go through a proxy so the web server can only determine this address. At home I use NAT via a server so this laptop I’m typing on has no external address. The closest thing is what is returned from ‘whatismyip’, my server address, through which I may sometimes forward ports that go to my laptop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This sounds dumb, but I can't get it to work. I think i just
Sounds like it should be a common problem, but I didn't find an obvious
Sounds like a let me google it for you question, but somehow I can't
Sounds dummy but I can't set to a server-side control's property a value contains
This sounds like a simple enough question, but can't find the answer for the
I know the title sounds funny, but I found this snippet somewhere: my MyPackage
This sounds very easy, but i don't get the point. So what's the easiest
This sounds like a relatively simple question, but I haven't been able to get
Sounds simple, but struggling to get this working. I thought it would be easy
This sounds like a simple one but I can't find the solution anywhere. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.