Running Godot Server on AWS Linux Cloud results in Error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NessaMithrandir

I am trying to run my basic server:

extends Node

const SERVER_PORT = 31909
var network = NetworkedMultiplayerENet.new()
var max_players = 10

func _ready():
	StartServer()

func StartServer():
	network.create_server(SERVER_PORT, max_players)
	network.set_bind_ip("<AWS Public IPv4>")
	get_tree().set_network_peer(network)
	print("Server started")
	network.connect("peer_connected", self, "_Peer_Connected")
	network.connect("peer_disconnected", self , "_Peer_Disconnected")

func _Peer_Connected(player_id):
	print("User " + str(player_id) + " connected")

func _Peer_Disconnected(player_id):
	print("User " + str(player_id) + " disconnected")

remote func message(message):
	print("received message")
	var client_id = get_tree().get_rpc_sender_id()
	rpc_id(client_id, "message", message)

With my basic Client:

extends Node

var network = NetworkedMultiplayerENet.new()
#var ip = "127.0.0.1"
var ip = "3.72.255.66"
var port = 1909

func _ready():
	ConnectToServer()

func ConnectToServer():
	network.create_client(ip,port)
	get_tree().set_network_peer(network)
	print("connecting to Server")
	
	network.connect("connection_failed", self, "_OnConnectionFailed")
	network.connect("connection_succeeded", self, "_OnConnectionSucceded")

func _OnConnectionFailed():
	print("Failed to connect")

func _OnConnectionSucceded():
	print("Succesfully connected")
	rpc_id(1, "message", "Test Nachricht")

remote func message(message):
	print(message)

On my AWS EC2 Instance per this tutorial: https://urodelagames.github.io/2022/04/19/setting-up-godot-server-on-aws/
But I alway get this error:

ERROR: create_server: Condition "!host" is true. Returned: ERR_CANT_CREATE
   At: modules/enet/networked_multiplayer_enet.cpp:108.
ERROR: set_network_peer: Condition "p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED" is true.
   At: core/io/multiplayer_api.cpp:147.

I use Godot 3.3.3_stable and Godot_v3.3.3-stable_linux_server.64. I already searched every link that comes up, when searching this error but nothing is relevent or helps…
And it really is strange, that when I run my client lokal I get the “peer_connected” signal but no message…

I solved the issue by switching to Godot 3.5 (of cause the godot linux server version too)

NessaMithrandir | 2022-08-26 09:04

:bust_in_silhouette: Reply From: zenbobilly

Try setting the “network” variables to onready.

Sadly this did not work, I also tried to initialize the network variable with NetworkedMultiplayerENet in the ConnectToServer function which also did not work…

NessaMithrandir | 2022-08-26 08:22