Expose to BP: get server port and IP address

Ok, I tried this:


int32 UGetServerIPAndPort::ServerIPAndPort()
{
    UWorld* wworld = GEngine->GameViewport->GetWorld();

        if (wworld->IsServer())
        {
            return wworld->URL.Port;
        }
        return 0;

}

But UE4 crash after calling it.
Could not find anywhere something related to this.
Little help here?

1 Like