RaknetCS 1.0.1

dotnet add package RaknetCS --version 1.0.1
                    
NuGet\Install-Package RaknetCS -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RaknetCS" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RaknetCS" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RaknetCS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RaknetCS --version 1.0.1
                    
#r "nuget: RaknetCS, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RaknetCS@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RaknetCS&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RaknetCS&version=1.0.1
                    
Install as a Cake Tool

<p align="center"> <h1 align="center">RaknetCS</h1> <p align="center"><i>A high-performance, modern .NET implementation of the RakNet protocol.</i></p> </p>

<p align="center"> <img src="https://img.shields.io/badge/.NET-9.0-512bd4?style=for-the-badge&logo=.net" alt=".NET 9.0"> <img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License MIT"> <img src="https://img.shields.io/github/actions/workflow/status/BedrockSharp/raknet-cs/build.yml?style=for-the-badge" alt="Build Status"> <img src="https://img.shields.io/badge/PRs-welcome-cyan?style=for-the-badge" alt="PRs Welcome"> </p>

RaknetCS is a performance-oriented, modernized C# implementation of the RakNet protocol. Designed for the high demands of game networking (particularly Minecraft Bedrock Edition), it provides a robust, reliable UDP transport layer with advanced packet handling and session management.


🚀 Features

  • Modern Architecture: Built for .NET 9.0+.
  • Reliability Layers: Supports Unreliable, Reliable, and Ordered packet delivery.
  • High Performance: Asynchronous socket operations for minimum latency.
  • Clean API: Intuitive classes for both Listeners (Servers) and Clients.
  • Packet Attribute System: Easy packet registration and dispatching.
  • Fragmentation & Reassembly: Automatically handles large data packets.

🛠️ Getting Started

Installation

Clone the repository and build the project:

git clone https://github.com/BedrockSharp/raknet-cs.git
cd raknet-cs
dotnet build

Running the Example Server

To see the project in action and see how it looks in the Minecraft server list:

# From the root directory
dotnet run --project src/RaknetCS.Example

This will start a server on port 19132. Open Minecraft Bedrock, go to the Friends tab, and you should see the "RaknetCS Demo Server" under Local Games.

Server Code Snippet

using System.Net;
using RaknetCS.Network;

var listener = new RaknetListener(new IPEndPoint(IPAddress.Any, 19132));
listener.Motd = "MCPE;My Awesome Server;..."; // Set your custom MOTD

listener.SessionConnected += (session) => {
    Console.WriteLine($"New session from: {session.PeerEndPoint}");
};

listener.BeginListener();

Client Example (RaknetClient)

using System.Net;
using RaknetCS.Network;

var client = new RaknetClient();
client.SessionEstablished += (session) => {
    Console.WriteLine("Connected to server!");
};

client.BeginConnection(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 19132));

📦 Defining Custom Packets

Use the attribute-based system to register your packets effortlessly:

[RegisterPacketID(0xFE)]
public class MyCustomPacket : Packet {
    public string Message;

    public MyCustomPacket(byte[] buffer) : base(buffer) {}

    protected override void Serialize(RaknetWriter stream) {
        stream.WriteString(Message);
    }

    protected override void Deserialize(RaknetReader stream) {
        Message = stream.ReadString();
    }
}

🤝 Contributing

Contributions are what make the open-source community such an amazing place!

  1. Fork the project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Please see CONTRIBUTING.md for details.

📄 License

Distributed under the MIT License. See LICENSE for more information.


<p align="center"> Maintained with ❤️ by the BedrockSharp team. </p>

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on RaknetCS:

Package Downloads
BedrockProtocol

A high-performance, modern .NET implementation of the Minecraft: Bedrock Edition protocol.

QuantumMC

Highly customized, lightweight and super-fast Minecraft: Bedrock Edition server software written in modern C#.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 240 4/17/2026
1.0.0 205 4/10/2026