getnamo / UDP-Unreal

Convenience UDP wrapper for the Unreal Engine.
MIT License
335 stars 79 forks source link

On Received Bytes event unable to fire on multiple pawns if Receive Port is the same #6

Closed Gliptal closed 3 years ago

Gliptal commented 5 years ago

I have multiple pawns, each inheriting an UPDComponent from the same parent. If Receive Port is different between the children, the Received Bytes event fires correctly for each of the children; if Receive Port is the same the event fires only on one instead (I suspect the first one that gets instanced).

Is there a way to have multiple children receive packets on the same port?

getnamo commented 5 years ago

I believe that's the way UDP works. A workaround would be to add a reference to a single udp component and you should be able to bind multiple targets to the same event (they are multicast delegates).

e.g. 1) Add UDP component to an actor of choice 2) get a reference to that actor in another actor, ask for its UDP component 3) bind to its OnReceivedBytes

That said there probably is a way to set the internal architecture such that if components have the same port, then use the same internal receiver and the multicast the bytes receives (also forward emit to the same outbound). That would be a plugin enhancement. Currently not a priority for me so I welcome dev code contributions on the issue.

Gliptal commented 5 years ago

After further investigation it does seem an inherent protocol limitation.

I'll switch to a master receiving actor like you suggested for now.