|Attention||Topic was automatically imported from the old Question2Answer platform.|
|Old Version||Published before Godot 3 was released.|
I’m having trouble setting up an asynchronous TCP connection with a server I created; what I’m currently doing is:
- Creating a new StreamPeerTCP object on my script.
The server-side looks correct (a new tcp client shows up), but on Godot I can’t seem to find any way to set signals for successful StreamPeer connections nor signals for receiving packets - I’m currently having to rely on _process to check when the connection state of the StreamPeerTCP ever changed, and the SceneTree signals
connected_to_server doesn’t seem to trigger ever. Is this a bug?
connected_to_server are signals from the high level API. When you use
StreamTCP.connect_to_host() it returns an error code that is OK or FAILURE. You can get the status of the connection with the method
StreamTCP.get_status() that returns the status of connection. See https://docs.godotengine.org/en/3.1/classes/class_streampeertcp.html
So, it is not a bug, you just dont use signals with this API.
Paracrazy | 2019-04-11 02:51