I'm using Godot v4.0.1 and have a code like this somewhere:
_stream.connect_to_host("127.0.0.1", 2357)
var message = PackedByteArray([0, 1, 112, 108, 97, 121, 101, 114, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 101, 105, 105, 103])
print("Putting data:", message, "(", len(message), ")")
# prints: Putting data:[0, 1, 112, 108, 97, 121, 101, 114, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 101, 105, 105, 103](22)
_stream.set_no_delay(true)
_stream.put_data(message)
On the other side (the server) I have some Python code that expects code:
data = remote.rfile.read(22) # where remote is socketserver.StreamRequestHandler
The problem: It seems that the GODOT stream does not send the data, because the rfile keeps reading forever or until I destroy the connection.
On the other hand, other python programs can interact with my server properly:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(("127.0.0.1", 2357))
auth_buffer = bytes([0, 1, 112, 108, 97, 121, 101, 114, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 101, 105, 105, 103])
client.send(auth_buffer)
This one sends the message properly, which is handled by the server.
What am I missing here?