The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I'm using Godot v3.0.6.stable.official.8314054

There are two problems caused by using StreamPeerTCP class.

I have a server written in Golang which accepts TCP connections. When a new connection is accepted, it is immediately closed by the server itself.

Then I have a Godot client which connects to the server by StreamPeerTCP. The connection status changes from 0 to 2 (NONE -> CONNECTING -> CONNECTED), there are no problems with connecting. The problems appear when the server closes the connection.

1) In docs there is a concrete proposal:

STATUS_NONE = 0 — The initial status of the StreamPeerTCP, also the status after a disconnect.

But when the server closes the connection, no changes to the status applied. It remains the same, STATUS_CONNECTED (I monitor this in _process, in every frame). And I don't know how to be notified of the disconnection from the server on the client (Godot) side.

2) An interesting behaviour one can see if it is a message with any data sent to the server by StreamPeerTCP when the connection is closed (as in my case). I use put_var("foo"). Know what? Godot engine just silently crashes. The program is closed and no any error messages are given. I didn't check some internal logs or whatever, but this behaviour is impermissible.

So the questions are: how to properly monitor disconnections from the external server and why behaviour declared in docs does not work? Does the latest unstable version of Godot corrects the issues?

in Engine by (26 points)

Found the same issue here:

But no concrete solution for more than two years..

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.