Why does PacketPeerStream send extra data?

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

I’m working on a multiplayer game in which the clients will connect to a Python server. I’m after connecting to the server with

var connection = StreamPeerTCP.new()
var wrapped_client = PacketPeerStream.new()
connection.connect_to_host( ip, port )

And then sending data with


However, the python server receives


As you can see, there is a prefix that seems to be null data. The hex representation of the data received on the server is as follows,

0c 20 20 20 04 20 20 20 02 20 20 20 68 69

This shows that there is a lot of excess data up until the last two bytes, which represent the characters “h” and “i”. What exactly is this data for? Is there any way to not send this excess information?

:bust_in_silhouette: Reply From: hungrymonkey

when you send a string down the network api, you are actually sending a variant.

according to the docs, the first 12 bytes are the header for the string.