How to get public IP address?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bush2Tree

Hey all,

I’d like to be able to get the public IP address of a server, from the server. I’m using NetworkedMultiplayerENet. How would I go about this?

:bust_in_silhouette: Reply From: rakkarage

A Simple Public IP Address API

:bust_in_silhouette: Reply From: gimri

var upnp = UPNP.new()
upnp.discover(2000, 2, “InternetGatewayDevice”)
print(upnp.query_external_address())

Great answer. The docs have more help on how to run it in a thread: UPNP — Godot Engine (stable) documentation in English

SteveSmith | 2023-02-01 17:08