Still trying with the class "NetworkedMultiplayerENet". I'm not getting the packages on the server. My server will not be using godot, I just want to test on a server in godot, and also because I will need to know how to listen for when the client listens for server messages.
When I send it to my external server, the message is coming like this " ���who am I?" instead of "who am I?", so I wanted to test on a godot server to better understand what's going on. But I am not even able to receive the packages, by the way never enter this block "if host.getavailablepacket_count () > 0:", although if I send a small message like this " " I get the error on the server:
ERROR: _network_process_packet: Condition 'p_packet_len <5' is true.
At: scene / main / scene_tree.cpp: 1906.
The server code:
extends Node
var host = NetworkedMultiplayerENet.new()
const SERVER_IP = "127.0.0.1"
const SERVER_PORT = 1507
func _ready():
get_tree().connect("network_peer_connected", self, "_player_connected")
host.create_server(SERVER_PORT, 4)
get_tree().set_network_peer(host)
func _process(delta):
if host.get_available_packet_count() > 0:
var array_bytes = host.get_packet()
printt("msg: " + array_bytes.get_string_from_utf8())
func _player_connected(id):
printt("_player_connected" + str(id))
Note: I get printt from the connected client console, as well as from the connected server client. So I believe the two are connected.