Is it possible to receive binary C struct (6 doubles) via PacketPeerUDP?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lehthanis
:warning: Old Version Published before Godot 3 was released.

I have been using PacketPeerUDP successfully to receive text/ascii based packets. But my needs have changed in order to match up with a larger project. The data is sent in I guess binary packets as a struct that contains 6 doubles. I need to receive those 6 doubles and deal with them in Godot. Is this possible?

I know this method exist for StreamPeer: StreamPeer — Godot Engine (latest) documentation in English
But no idea if it’s going to work in your case. It probably will if your double is encoded the exact same way on both ends (also beware if the struct is sent as raw memory or serialized in deterministic order).
I don’t see a StreamPeerUDP though, perhaps the API is different for this protocol. I’d be curious if someone knows.

Zylann | 2016-11-24 10:11