LiteNetLib 1.3.5
dotnet add package LiteNetLib --version 1.3.5
NuGet\Install-Package LiteNetLib -Version 1.3.5
<PackageReference Include="LiteNetLib" Version="1.3.5" />
<PackageVersion Include="LiteNetLib" Version="1.3.5" />
<PackageReference Include="LiteNetLib" />
paket add LiteNetLib --version 1.3.5
#r "nuget: LiteNetLib, 1.3.5"
#:package LiteNetLib@1.3.5
#addin nuget:?package=LiteNetLib&version=1.3.5
#tool nuget:?package=LiteNetLib&version=1.3.5
LiteNetLib
Lite reliable UDP library for .NET Standard 2.0 (Mono, .NET Core, .NET Framework)
HighLevel API Part: LiteEntitySystem
OLD BRANCH (and examples) for 0.9.x
Build
NuGet

Release builds 
DLL build from master 
( Warning! Master branch can be unstable! )
Features
- Lightweight
- Small CPU and RAM usage
- Small packet size overhead ( 1 byte for unreliable, 4 bytes for reliable packets )
- Simple connection handling
- Peer to peer connections
- Helper classes for sending and reading messages
- Multiple data channels
- Different send mechanics
- Reliable with order
- Reliable without order
- Reliable sequenced (reliable only last packet)
- Ordered but unreliable with duplication prevention
- Simple UDP packets without order and reliability
- Fast packet serializer (Usage manual)
- Automatic small packets merging
- Automatic fragmentation of reliable packets
- Automatic MTU detection
- Optional CRC32C checksums
- UDP NAT hole punching
- NTP time requests
- Packet loss and latency simulation
- IPv6 support (using separate socket for performance)
- Connection statistics
- Multicasting (for discovering hosts in local network)
- Unity support
- Support for .NET8 optimized socket calls (much less gc)
- Supported platforms:
- Windows/Mac/Linux (.NET Framework, Mono, .NET Core, .NET Standard)
- Lumin OS (Magic Leap)
- MonoGame
- Godot
- Unity 2018.3 (Desktop platforms, Android, iOS, Switch)
Support developer
USDT TRC20:
TE5eBgq8SyEeZFKtCgZG9GwL34sANmbc67USDT BEP20/ERC20:
0x4c0D6DC76c6A6B354f5ec6c9e51893fFC6510d1EBitcoin:
bc1q269ecs8r5vnrum5qr5j98sdglhnxlulv0f6egd
Unity notes!!!
- Minimal supported Unity is 2018.3. For older Unity versions use 0.9.x library versions
- Always use library sources or OpenUPM package instead of precompiled DLL files ( because there are platform specific #ifdefs and workarounds for unity bugs )
Usage samples
Client
EventBasedNetListener listener = new EventBasedNetListener();
NetManager client = new NetManager(listener);
client.Start();
client.Connect("localhost" /* host IP or name */, 9050 /* port */, "SomeConnectionKey" /* text key or NetDataWriter */);
listener.NetworkReceiveEvent += (fromPeer, dataReader, deliveryMethod, channel) =>
{
Console.WriteLine("We got: {0}", dataReader.GetString(100 /* max length of string */));
dataReader.Recycle();
};
while (!Console.KeyAvailable)
{
client.PollEvents();
Thread.Sleep(15);
}
client.Stop();
Server
EventBasedNetListener listener = new EventBasedNetListener();
NetManager server = new NetManager(listener);
server.Start(9050 /* port */);
listener.ConnectionRequestEvent += request =>
{
if(server.ConnectedPeersCount < 10 /* max connections */)
request.AcceptIfKey("SomeConnectionKey");
else
request.Reject();
};
listener.PeerConnectedEvent += peer =>
{
Console.WriteLine("We got connection: {0}", peer); // Show peer IP
NetDataWriter writer = new NetDataWriter(); // Create writer class
writer.Put("Hello client!"); // Put some string
peer.Send(writer, DeliveryMethod.ReliableOrdered); // Send with reliability
};
while (!Console.KeyAvailable)
{
server.PollEvents();
Thread.Sleep(15);
}
server.Stop();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (28)
Showing the top 5 NuGet packages that depend on LiteNetLib:
| Package | Downloads |
|---|---|
|
EdenNetwork
Simple C# TCP/UDP socket server&client API for .NET & Unity |
|
|
Shaman.LiteNetLibAdapter
Package Description |
|
|
ShareLib.Network
网络基础帮助库 |
|
|
CitiesSkylinesMultiplayer.API
API for Multiplayer mod for Cities: Skylines |
|
|
FTServer
Package Description |
GitHub repositories (12)
Showing the top 12 popular GitHub repositories that depend on LiteNetLib:
| Repository | Stars |
|---|---|
|
SubnauticaNitrox/Nitrox
An open-source, multiplayer modification for the game Subnautica.
|
|
|
OpenSAGE/OpenSAGE
OpenSAGE is a free, open source re-implementation of SAGE, the 3D real time strategy (RTS) engine used in Command & Conquer: Generals and other RTS titles from EA Pacific. Written in C#. Not affiliated with EA.
|
|
|
Mr-sans-and-InitLoader-s-team/Escape-From-Duckov-Coop-Mod-Preview
逃离鸭科夫联机mod(by Mr.sans & InitLoader)
|
|
|
Reloaded-Project/Reloaded-II
Universal .NET Core Powered Modding Framework for any Native Game X86, X64.
|
|
|
CitiesSkylinesMultiplayer/CSM
Source code for the Cities: Skylines Multiplayer mod (CSM)
|
|
|
rwmt/Multiplayer
Zetrith's Multiplayer mod for RimWorld
|
|
|
UltraStar-Deluxe/Play
Free and open source singing game with song editor for desktop and mobile
|
|
|
Bannerlord-Coop-Team/BannerlordCoop
|
|
|
RevenantX/LiteEntitySystem
Pure C# HighLevel API for multiplayer games
|
|
|
RighteousRyan1/TanksRebirth
A complete rebuild of Wii Play's Tanks game mode. Attempting to stay true to the original game.
|
|
|
boonkerz/teamscreen
It should be an Teamviewer/Vnc/Something replacement
|
|
|
roy-t/MiniRTS
A game engine to learn about game engine development
|