Get my public ip

Hey guys, I was wondering if there is an easy way in Unreal to get my outer/public IP. I am asking this because I am building a server browser( which works fine now since connecting is not an issue ) but I also want to host games from within unreal. An in order to do so I need to send my IP somehow. Is there a way to get this information and if not what other way do you advice me to solve this problem.

Thanks,
Oz

1 Like

A server browser requires an external application that holds the list of available servers. That application will get the public IP of the server when the server registers itself as available.

Hey! Thanks for replying!

Yeah I’m using Parse.com for now to store the servers. The current setup I have is that I wrote a small C# app called SLaunch.exe. I’ve told my users to use that instead of the game executable.

With the app you can either host( it will get your public ip and create a new data row on my parse.com database) or join a server ( it will fetch all the rows from my parse.com database).

When I moved to UMG I rewrote the joining part to be in-game. So I use VaREST plugin( love this plugin ) to fetch the data from my database and this works great, is a glimpse of that:

https:///?v=&list=UUxvJ3-RKaKtzADb2luE1_ag

Now I was hoping to also move the HOSTING part to in-game. So that I wont be relying on another external app to launch the game. In order to do this, I need a way to get my public IP so that I can send that data to my database from within the game.

If I find a way to do this, I’ll have a decent enough server browser completely in-game :slight_smile:

I don’t know the Parse APIs but you may be able to pull the public IP from when you connect to their service. You’ll need to check their documentation for that. You could send a HTTP request to www.whatsmyip.org and parse the results of that. They may have a REST API for that.

1 Like

Hey, yeah I had a similar idea but when I googled it ( and others have asked this too on Parse.com ) it turns out that they don’t have such a thing yet.

So what I probably have to do is do the manual HTTP requests I guess. After a quick search I found that I can do HTTP stuff from within UE so I’ll start to figure out how now :slight_smile: Weird that I didn’t think of that.
Thanks!

#Thank You

That was a great idea Graf! Thanks!

I finally succeeded in making a BP Node that returns your local computer’s IP address!

's Victory BP Library

#Website

I am relying on this website to return me my IP
http://api.ipify.org

#C++ Source Code For You

The source code for how I did this is in my plugin download, please see VictoryPC.h and VictoryPC.cpp

I had to use an actual player controller class with a BlueprintImplementableEvent because a HTTP Request/Response is involved.

#Enjoy!

#:heart:

is the best. :slight_smile:

Recently I did a plugin for that. Works for BP and C++

https://github.com/alexhajdu/WhatsMyPublicIP-ue4-plugin

Awesome Work @alex-unrealUGSK

popular ip address

thanks for this sharing, will this service be online forever???