⚡️ ENet reliable UDP networking library
This is a fork of the original library lsalzman/enet. While original repo offers a stable, time-tested wonderful library, we are trying to change some things, things, which can't be reflected on the main repo, like:
ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). The primary feature it provides is optional reliable, in-order delivery of packets, and fragmentation.
ENet omits certain higher level networking features such as authentication, lobbying, server discovery, encryption, or other similar tasks that are particularly application specific so that the library remains flexible, portable, and easily embeddable.
Download file releases/latest/enet.h and just add to your project.
Build the shared library:
$ cmake -B build -DENET_SHARED=1 -DCMAKE_BUILD_TYPE=Release
$ cmake --build buildUse it:
#define ENET_DLL
#include
#include
int main() {
if (enet_initialize () != 0) {
printf("An error occurred while initializing ENet.\n");
return 1;
}
enet_deinitialize();
return 0;
}Build the static library:
$ cmake -B build -DENET_STATIC=1 -DCMAKE_BUILD_TYPE=Release
$ cmake --build buildUse it:
#include
#include
int main() {
if (enet_initialize () != 0) {
printf("An error occurred while initializing ENet.\n");
return 1;
}
enet_deinitialize();
return 0;
}In this case, library will be embedded to the project itself.
Make sure you add a define for ENET_IMPLEMENTATION exactly in one source file before including the enet.h.
Here is a simple server and client demo, it will wait 1 second for events, and then exit if none were found:
Server:
…Client:
…More information, examples and tutorials can be found at the official site: http://enet.bespin.org/
No open issues yet, or sync has not completed.