Closed erioxis closed 2 years ago
This exact same thing happened to me, but I'm using https://github.com/zpl-c/enet. After some debugging, turns out we have undefined behavior with that modification of ENet: an uninitialized variable. In file enet.c
, line 219, change ENetAddress address;
to ENetAddress address = {0};
.
The field sin6_scope_id
of the struct ENetAddress
does not exist in the original ENet library so it is not being assigned. It may contain garbage and seems like it needs to be zero for enet_host_create
to work.
It was simpler than I thought. Check your firewall rules. After I allowed everything to the port I used, host wasn't nil anymore!
host
is nil
because the call to host_create
failed and returned nil
. In Lua it's typically for functions to return two values on error, nil as the first and a string describing the error. There can be many reasons why host might fail to create, the most common is that something else is already listening on that port.
Hope that helps.
I am triyng to run server example but get error