0 votes
extends Panel
var tcp

func _ready():
    tcp = StreamPeerTCP.new()
    var result = tcp.connect_to_host("", 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())
            $StatusLabel.text = str(s)

func _on_Button_pressed():
    $StatusLabel.text = str("ping")

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.

in Engine by (16 points)

I found that windows10 send packets for size chunk and user string seperately.

1 Answer

0 votes

Using tcp.put_data() doesn't make this problem because put_data doesn't put size chunk.

by (16 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.