Closed UnidayStudio closed 3 years ago
That won't work as you have written it. It's best to think of the connection handshake of having an indeterminate amount of interleaved stages, so if you only service the server, then the client, then exit, the handshake for the connection will never have the opportunity to finish. It may take multiple passes of servicing server and client for things to settle.
That won't work as you have written it. It's best to think of the connection handshake of having an indeterminate amount of interleaved stages, so if you only service the server, then the client, then exit, the handshake for the connection will never have the opportunity to finish. It may take multiple passes of servicing server and client for things to settle.
Could you provide a "hello, world" example? I'm just trying to figure out how to get the basics working. Thank you!
Quick update (for those who had the same problem):
I've managed to figure out how to fix my code by looking for some python enet examples (pyenet). I realized that my code was missing the enet_address_set_host(&address, "localhost");
in the initialization, right here:
// Server address:
ENetAddress address;
address.host = ENET_HOST_ANY;
address.port = 1234;
enet_address_set_host(&address, "localhost");
Now it works as expected. :)
I've been trying to figure out enet for some days now, reading the tutorial, but I'm having a hard time trying to get it working.
I'm trying to make a basic echo stuff, in a single file, just to see if I'm able to create a server, connect to it and send a message, nothing fancy. It's not working.
I'll leave all the code bellow. For your information, I'm having no errors or exception. It simply doesn't Log anything in the console... from my understanding, it was supposed to log that the client connected at least (or return a NULL peer, I guess?)
Initialization:
in the Gameloop...
Shutdown