This commit is contained in:
Hartmut Seichter 2025-06-27 12:24:18 +02:00
parent 9e60cbd0e9
commit 2273a9824a

View file

@ -31,7 +31,7 @@ func _process(delta: float) -> void:
if new_status == _stream.STATUS_CONNECTED:
var available_bytes: int = _stream.get_available_bytes()
if available_bytes > 0:
print("available bytes: ", available_bytes)
#print("available bytes: ", available_bytes)
var res = _stream.get_partial_data(available_bytes)
if res[0] != OK:
emit_signal("error")
@ -59,18 +59,19 @@ func _on_data(data : Array):
var bytes = PackedByteArray(data)
var as_cookie = bytes.get_string_from_ascii()
# Cookie Hack!
if as_cookie.begins_with("vrpn: ver."):
print("VRPN magic cookie '{0}'".format([as_cookie]))
#print("VRPN magic cookie '{0}'".format([as_cookie]))
# kaboom we just send back the same cookie :)
self.send(bytes)
else:
if true:
var header_bytes = bytes.slice(0,24)
var header_i32 = header_bytes.to_int32_array()
#var vrpn_h = VRPN_Header.new(header_bytes)
print(header_i32)
print(header_bytes)
# non-cookie messages
var header_bytes = bytes.slice(0,24)
var header_i32 = header_bytes.to_int32_array()
#var vrpn_h = VRPN_Header.new(header_bytes)
#print(header_i32)
#print(header_bytes)
print(bytes)
func _on_connected(s : StreamPeerTCP):
print("Connected to",s.get_connected_host()) # Replace with function body.