Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:ENet

From ReverseEngineering.wiki
Library
Developer Lee Salzman
Platforms Windows, Linux, macOS, consoles
License MIT
Website https://github.com/lsalzman/enet
On this wiki Facts · Code · Notes · Topics

ENet is a small reliable-UDP networking library (C, MIT) used by many games and engines (Godot's ENet multiplayer, Cube/Sauerbraten, many indie titles): a 4 or 2-byte packet header followed by 1-32 commands, 13 command types, optional range-coder compression and CRC checksum.

Overview

ENet gives UDP connections with up to 255 channels per peer, reliable and unreliable delivery, fragmentation and per-peer throttling. It is usually statically linked; source files are callbacks.c, compress.c, host.c, list.c, packet.c, peer.c, protocol.c, unix.c/win32.c. The version macros at commit 5a9c537fd464b3c6d3c55e1d3bd47588faf71b42 say 1.3.18.

Identifying it

  • Symbol names with the enet_ prefix: enet_initialize, enet_host_create, enet_host_service, enet_host_connect, enet_peer_send, enet_packet_create, enet_host_compress_with_range_coder, enet_time_get. Stripped static builds still contain the 13-entry commandSizes table (see the command fact) and the constants 576, 4096, 32 and 0xFFF.
  • On the wire there is no magic number. Before a handshake completes a peer's outgoingPeerID is 0xFFF (peer.c), so the first CONNECT datagram of a client has 0xFFF in the low 12 bits of the first 16-bit field (big-endian), plus the session bits and flags above them.

Wire format

See the facts on this page: protocol header, command header and flags, command numbers, CONNECT. All multi-byte fields are big-endian (ENET_NET_TO_HOST_16/32 in protocol.c).

Code & repositories

  • https://github.com/lsalzman/enet (MIT). include/enet/protocol.h holds every wire struct; protocol.c the state machine.
  • https://github.com/lsalzman/enet @ 5a9c537fd464b3c6d3c55e1d3bd47588faf71b42 · license: MIT
    ENet reliable UDP library; include/enet/protocol.h has all wire structs
    Tested on: source read, not run: source read only · checked 2026-10-18; last activity 2026-06-23

Related

Other UDP game transports: Library:RakNet, Library:GameNetworkingSockets.