nxrighthere/ENet-CSharp
FreeReliable UDP networking library
FreeFree tier
About nxrighthere/ENet-CSharp
ENet-CSharp is an independent implementation of the ENet reliable UDP networking protocol, modified for use with C, C++, C#, and other languages. It provides a lightweight, low-resource networking library with dual-stack IPv4/IPv6 support, connection management, sequencing, channels, reliability, fragmentation and reassembly, aggregation, adaptability, and portability. It includes compiled assemblies for .NET Standard 2.1 and Unity, with native libraries for Windows, Linux, macOS (x64), and support for mobile platforms (Android, iOS) and Nintendo Switch via manual compilation. The library requires initialization and deinitialization, and offers a straightforward API for hosting servers and connecting clients.
Key Features
Lightweight and straightforward
Low resource consumption
Dual-stack IPv4/IPv6 support
Connection management
Reliability
Fragmentation and reassembly
Aggregation
Adaptability
Portability
Independent ENet implementation with modified protocol
Pros & Cons
Pros
- Lightweight and low resource consumption
- Cross-platform support (Windows, Linux, macOS, mobile, Nintendo Switch)
- Provides reliable and unreliable data channels
- Easy to integrate with C# projects via NuGet or Unity package
Cons
- Requires compilation of native libraries for each target platform
- Limited to UDP transport (no TCP fallback)
- Common mistakes documentation is essential to avoid issues
Best For
Multiplayer game networkingReal-time communication applicationsClient-server architecture for gamesNetworked simulation environments
FAQ
How do I initialize the library?
Call ENet.Library.Initialize() before using any ENet functions, and call ENet.Library.Deinitialize() when done.
What platforms are supported?
Windows 7+, Linux 4.4+, macOS 10.12+ (x64), plus Android and iOS with NDK/Xcode, and Nintendo Switch with appropriate tools.
Is there a NuGet package?
Yes, ENet-CSharp is available as a NuGet package for .NET environment, and ENet-Unity for Unity.
Does it support IPv6?
Yes, it supports dual-stack IPv4/IPv6.