Enet peer_packet channel of origin

Godot Version

4.3 stable

Question

Hey got a question regarding getting information when handling raw enet packets on both client and server side.

I got a custom server and client code using ENet and the built-in Multiplayer Api from godot.

Using SceneMultiplayer I got a listener for packets hooked up to peer_packet. This gets the peer ID as the origin of the packet and the packet itself. I’m using multiple channels to send packets through and I kinda need to know which channel has the packet arrived through. Is there a way to get that information?

I guess it can be done if I went even beyond that and didn’t use Multiplayer api but disbanding that and go straight into just using ENetConnection on both ends but then I’d have to do the whole implementation with loops for handling event types and what have you. So I was hoping I could avoid that.

Everything seems to work fine in terms of connecting client to server and sending packets back and forth. Identifying the channel from which the packet came from is the last thing I need.

Any helpers? :smiley:

The channel is usually given control via the RPC declaration. @rpc(authority, call_remote, reliable, <channel>)

You should also take a look at MultiplayerPeer — Godot Engine (stable) documentation in English

It has some infor on channels.