The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

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!

Godot version 4.0.alpha14
in Engine by (16 points)

1 Answer

+3 votes
Best answer

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 https://github.com/godotengine/godot/pull/64877 ).
Hopefully, it should be fixed by alpha15

by (98 points)
selected by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.