Sriram
Sriram Creator of geeky things, mostly unused junk

What is my IP?

I wanted a simple, free, no-limits way of finding out my own public IP. I also wanted a way to use it in my Java code so I wouldn’t need a really complex, and non-guaranteed way of finding the IP. I can’t believe the number of times I’ve searched for “How to get my public IP in Java?” or several variations of the same and I was tired of it.

I wrote a simple server which has one endpoint which returns the IP address of the called. It’s a no-frills service that you can host yourself.

You can find the code for this service here or you could download a pre-compiled jar which can be run on your server here.

The core of the code, if you want to include in your own Java program is in this Gist:

comments powered by Disqus