Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | tifereth |
extends Panel
var tcp
func _ready():
tcp = StreamPeerTCP.new()
var result = tcp.connect_to_host("192.168.0.111", 1234)
func _process(delta):
if tcp and tcp.is_connected_to_host():
if tcp.get_available_bytes() > 0:
var s = tcp.get_utf8_string(tcp.get_available_bytes())
print(tcp.get_available_bytes())
print(str(s))
$StatusLabel.text = str(s)
func _on_Button_pressed():
$StatusLabel.text = str("ping")
tcp.put_utf8_string($LineEdit.text)
Made a simple tcp project, and run on MacOSX first. Server is python.
I noticed 4bytes little endian data which tells the size of sent data was attached in front of the utf-8 string what I typed in the LineEdit.
When I tried to run the same project on Windows10, the packet was came without size data attached on the same server.
Does it come from OS difference? Godot engine versions are same as 3.0.6.
I found that windows10 send packets for size chunk and user string seperately.
tifereth | 2018-09-13 05:30