WIP
This commit is contained in:
parent
9e60cbd0e9
commit
2273a9824a
1 changed files with 10 additions and 9 deletions
|
@ -31,7 +31,7 @@ func _process(delta: float) -> void:
|
||||||
if new_status == _stream.STATUS_CONNECTED:
|
if new_status == _stream.STATUS_CONNECTED:
|
||||||
var available_bytes: int = _stream.get_available_bytes()
|
var available_bytes: int = _stream.get_available_bytes()
|
||||||
if available_bytes > 0:
|
if available_bytes > 0:
|
||||||
print("available bytes: ", available_bytes)
|
#print("available bytes: ", available_bytes)
|
||||||
var res = _stream.get_partial_data(available_bytes)
|
var res = _stream.get_partial_data(available_bytes)
|
||||||
if res[0] != OK:
|
if res[0] != OK:
|
||||||
emit_signal("error")
|
emit_signal("error")
|
||||||
|
@ -59,18 +59,19 @@ func _on_data(data : Array):
|
||||||
var bytes = PackedByteArray(data)
|
var bytes = PackedByteArray(data)
|
||||||
var as_cookie = bytes.get_string_from_ascii()
|
var as_cookie = bytes.get_string_from_ascii()
|
||||||
|
|
||||||
|
|
||||||
# Cookie Hack!
|
# Cookie Hack!
|
||||||
if as_cookie.begins_with("vrpn: ver."):
|
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)
|
self.send(bytes)
|
||||||
else:
|
else:
|
||||||
if true:
|
# non-cookie messages
|
||||||
var header_bytes = bytes.slice(0,24)
|
var header_bytes = bytes.slice(0,24)
|
||||||
var header_i32 = header_bytes.to_int32_array()
|
var header_i32 = header_bytes.to_int32_array()
|
||||||
#var vrpn_h = VRPN_Header.new(header_bytes)
|
#var vrpn_h = VRPN_Header.new(header_bytes)
|
||||||
print(header_i32)
|
#print(header_i32)
|
||||||
print(header_bytes)
|
#print(header_bytes)
|
||||||
|
print(bytes)
|
||||||
|
|
||||||
func _on_connected(s : StreamPeerTCP):
|
func _on_connected(s : StreamPeerTCP):
|
||||||
print("Connected to",s.get_connected_host()) # Replace with function body.
|
print("Connected to",s.get_connected_host()) # Replace with function body.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue