# How to get your public IP address in-game

**URL:** <https://forums.unrealengine.com/t/how-to-get-your-public-ip-address-in-game/620150>\
**Category:** Multiplayer & Networking\
**Tags:** unreal-engine, UE5-0, UE4, Blueprint, CPP, question\
**Created:** [August 2, 2022, 11:13pm UTC](https://forums.unrealengine.com/t/how-to-get-your-public-ip-address-in-game/620150 "2022-08-02T23:13:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b04a32c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b04a32c1](https://forums.unrealengine.com/u/anonymous_user_b04a32c1)\
**Post date:** [August 2, 2022, 11:13pm UTC](https://forums.unrealengine.com/t/how-to-get-your-public-ip-address-in-game/620150/1 "2022-08-02T23:13:06Z")

</div>

Is there a way to get your IP address in-game. As in the .exe is running and it needs to get the computer public IP address.

The reason I need this is cuz if you have 1 server, ez you know it’s IP address and you can just have it as a variable. BUT if you have 1000 or more servers, it starts being nigh-impossible to do that. Mostly since you’d have to make 1 program for each server, even 10 servers would already be a hassle.

So, is there way to do it, and if there is could someone explain it to me? SOmeone said you can use c++ to run windows commands, but this is a linux server. And if there is a way could you develop further, as in what would I need to do to make a c++ class to do this and expose it to blueprints.

---

<div class="post-metadata">

**Author:** ![letters](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@letters](https://forums.unrealengine.com/u/letters)\
**Post date:** [August 2, 2022, 11:31pm UTC](https://forums.unrealengine.com/t/how-to-get-your-public-ip-address-in-game/620150/2 "2022-08-02T23:31:59Z")

</div>

If it is a linux server you can call the command curl to any webpage that gives your public IP, like [ipconfig.org](http://ipconfig.org). In C it could be something like:  
FILE \*f = popen(“curl -s [ipconfig.org](http://ipconfig.org)”, “r”);  
and read f as one line.
