How to get the player's internal IP address?

How can I get a player’s internal, local IPV4 address in-game? (Like 192.168.xx.xx). My project is going to be released on Android, so I cannot use the command prompt or other Windows-specific things.
Any help would be greatly appreciated!

If I’m correct the data to receive the IPV4 address can be found in UNetConnection. There is an instance of this class within APlayerController.
The RemoteAddressToString function of UNetConnection should return the information you are looking for.…ion/index.html

I don’t have a project in which I’m able to test it currently, can you verify if it is what you are looking for?

I’m quite new to C++ in ue4, so if possible, I’d really appreciate it if you could walk me though the steps to make it work!

Also what if we want the LOCAL IP address, not the public one? Does it work for that?

This is a bit unwise, as it can be nullptr if you are playing just locally or are the server.
see: [APlayerController | Unreal Engine Documentation

Ok so for anyone having this issue, you can use this plugin, which will allow you to get the IPV4 address locally via UPNP. I haven’t tested it, but it may point you in the right direction -…on-for-release

Another option would be to use the Socket subsystem. Add the “Sockets” module to your build.cs. Then:

#include "SocketSubsystem.h"


bool bCanBindAll;
TSharedPtr<class FInternetAddr> Addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, bCanBindAll);
FString MyIP = Addr->ToString(false); 

1 Like

Plugin Simple UDP TCP Socket Client

Thank you for your post,
it helped me

Cool. Navigating this engine isn’t exactly easy, so I’m glad this info was of use to someone.

1 Like

Yeah your correct,
your code work for android & Pc, Can you help me for getting ios ip address,
i’m new to c++