ENet Networking Example C

I found a good example to get started with ENet, written by Mike Diehl, but it had some bugs so I fixed them. Plus, a pain in the ass to download. So, here is the cleaned up downloadable package. But before I offer it, you must have downloaded and installed ENet library yourself http://enet.bespin.org/

ENet Example Code [ZIP]

p.s. the original example is explained in full detail at http://www.linuxjournal.com/content/network-programming-enet, and it’s pragmatically identical to my download with the exception of minor bug corrections.

Inside the archive are the source code and header file, as well as a compilation script you can probably get away with running directly, if you are on a *nix based machine.

gcc -I/Users/bazz/include -L/Users/bazz/lib $1.c -o $1 -lenet

This is clearly setup for my home machine, but you can run it unmodified if you installed ENet into your system directories — default is /usr/local

you run the script to compile the apps by doing:

./compile.sh client
./compile.sh server


1 Comment on “ENet Networking Example C

  1. Thanks for the example. Saved me lots of hassle. Been trying to find low latency networking code (have to avoid TCP/IP) for ages (as in a decade!).

Leave a Reply

Your email address will not be published. Required fields are marked *