Placing the integer 10 into put_u32() fails to send the u32 over the wire (TCP)

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

This issue is extremely strange to me. I’ve been working in Godot on an online game and using TCP StreamPeer for about 2 years now.

In this scenario I’m placing two concepts, object_type and object_id into my connection stream using the following code:

func send_get_options_packet(_event, object_type, object_id):
var conn = ConnectionHandler.Connection #StreamPeerTCP object here
conn.put_u16(301) # Don't mind this input
conn.put_u16(object_type) # Currently set to 1
conn.put_u32(object_id) # This number varies. It works to send to server on the input 9, 11, 100 etc.. 

On the last conn.put_u32(object_id). If the integer == 10 the payload is not sent to my server. I’ve manually put in integers to this and tested. Lo and behold 9 works, 11 works, 100 works. Anything I put in seems to send over except the integer 10.

Any ideas what might be happening? Is it confusing the input somehow? Any help is very much appreciated.

For extra intel here is my server log output I print out whenever I receive a TCP payload on the server side:

Normal Proper Paylod with 9 as the input on object_id

 Payload: [45 1 1 0 9 0 0 0 10]

Invalid Payload when the integer 10 is written as object_id

Payload: [45 1 1 0 10]

You can clearly see the payload is not writing the 4 bytes that normally would be included on the u32.