0 votes

So I have created a Standalone ENet server in C++, which seems to be working okay, but I am having issues sending data to it from Godot. When I run my client, it seems to be able to connect to the server without issue, but fails to send any data.

I've checked with Wireshark and there is no packets containing my test data.

My server code is just priting info about any ENet event.

My Client Code:

var network : NetworkedMultiplayerENet func ready():
to_network() func connecttonetwork():
network = NetworkedMultiplayerENet.new() print("Create client: " + str(network.create_client(SERVER_HOST, SERVER_PORT))) get_tree().set_network_peer(network) print("Send Packet: " + str(network.put_packet("TEST".to_ascii()))) print("Multiplayer Packet:" + str(get_tree().multiplayer.network_peer.put_packet("TEST2".to_ascii())))

My client output:

Create client: 0
Send Packet: 3
Multiplayer Packet:3

Server output:

Starting game server...
Started server console...
Awaiting connections...
Parsing event!
A new client connected from ______.
Parsing event!
(null) disconnected.

Things I've tried:


I've added

gettree().multiplayer.networkpeer = network

after creating the network, and it didn't seem to have an effect.


I've ran

print("Send Packet: " + str(network.putpacket("TEST".toascii()))) print("Multiplayer Packet:" + str(gettree().multiplayer.networkpeer.putpacket("TEST2".toascii())))

on button press instead which changed output to

Send Packet: 0
Multiplayer Packet: 0

But I did not see any data in Wireshark
asked Apr 19 in Engine by yesLayla (18 points)

1 Answer

+1 vote

So I it looks like the Godot implementation of ENet is not a ENet library, but a multiplayer implementation that uses ENet.

I found this module that seems to work for my purposes.


answered Apr 20 by yesLayla (18 points)
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.