Is it possible to get a peer's IP address using the high-level multiplayer API in Godot 4?

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

I’m looking to set up multiplayer using Godot 4’s new networking APIs and am currently establishing connections using ENetMultiplayerPeer. I looked around the docs for a bit but couldn’t find a way to get a connected peer’s IP address from the server - is this possible?

I’m aware it’s possible to get this information using the lower-level APIs (i.e. TCP and UDP servers), but I would be forfeiting all of the added node replication/RPC functionality as far as I understand.

I’m new to Godot’s networking APIs - any help would be appreciated!

:bust_in_silhouette: Reply From: Fales

It should be possible via:

enet.get_peer(peer_id).get_remote_address()
enet.get_peer(peer_id).get_remote_port()

But the methods are not correctly exposed in alpha14 ( see [Net] Expose get_remote_address/get_remote_port. by Faless · Pull Request #64877 · godotengine/godot · GitHub ).
Hopefully, it should be fixed by alpha15

Thank you! I was looking everywhere on the docs for something like this, makes sense why I couldn’t find it now lol.

thesink | 2022-08-25 20:46