0 votes

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.

in Engine by (195 points)

I realized that the error is probably coming from here https://github.com/godotengine/godot/blob/master/modules/enet/networked_multiplayer_enet.cpp#L275 and if that is it, the package has the size smaller than 12bytes, then something is happening while submitting that it would not be sending right here https://github.com/godotengine/godot/blob/master/modules/enet/networked_multiplayer_enet.cpp#L438. but I would not know why it is coming to the outer server, even though it is arriving like this " ���who am I?" . I have no idea.

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 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.